Implementation of DataBase native save/restore in JSON (step 2).
* New: In boostrap, in ccb.py, added support for the "support" project which contains external dependencies. Currently contains only RapidJSON. Those dependencies must be cloned here manually. * New: In Hurricane, Initializer class for an ordered static initialization across different compilation modules. * Change: In Hurricane, at DataBase level, no longer save the Cells in the libraries, but create and ordered list of Cell. Deepest cells (leaf cells) first. To avoid dependency problems. * New: In Hurricane, JSON support for Property. * New; In CRL, added JSON support for AllianceFramework, Environement & Catalog and their associated properties. Adjustment of the AllianceLibrary creation policy.
This commit is contained in:
parent
f537a10d45
commit
5baddeb558
4
Makefile
4
Makefile
|
@ -55,8 +55,8 @@ check_dir:
|
|||
|
||||
|
||||
install: check_dir
|
||||
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="$(SMP_FLAGS) install"
|
||||
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=coriolis --make="-j1 install" --doc
|
||||
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=support --project=coriolis --make="$(SMP_FLAGS) install"
|
||||
@./bootstrap/ccb.py $(DEVTOOLSET_OPTION) --project=support --project=coriolis --make="-j1 install" --doc
|
||||
@echo ""; \
|
||||
echo "============================================================================"; \
|
||||
echo "Coriolis has been successfully built"; \
|
||||
|
|
|
@ -47,13 +47,16 @@ To build Coriolis, ensure the following prerequisites are met:
|
|||
* bison & flex.
|
||||
* Qt 4 or 5.
|
||||
* libxml2.
|
||||
* RapidJSON
|
||||
* A C++11 compliant compiler.
|
||||
|
||||
The build system relies on a fixed directory tree from the root
|
||||
of the user currently building it. Thus first step is to get a clone of
|
||||
the repository in the right place. Proceed as follow: ::
|
||||
|
||||
ego@home:~$ mkdir -p ~/coriolis-2.x/src
|
||||
ego@home:~$ mkdir -p ~/coriolis-2.x/src/support
|
||||
ego@home:~$ cd ~/coriolis-2.x/src/support
|
||||
ego@home:~$ git clone http://github.com/miloyip/rapidjson
|
||||
ego@home:~$ cd ~/coriolis-2.x/src
|
||||
ego@home:src$ git clone https://www-soc.lip6.fr/git/coriolis.git
|
||||
ego@home:src$ cd coriolis
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
projectdir = 'coriolis-2.x'
|
||||
|
||||
projects = [
|
||||
{ 'name' : "coriolis"
|
||||
{ 'name' : "support"
|
||||
, 'tools' : [ "rapidjson"
|
||||
]
|
||||
, 'repository': 'No_repository_for_support'
|
||||
}
|
||||
, { 'name' : "coriolis"
|
||||
, 'tools' : [ "bootstrap"
|
||||
, "vlsisapd"
|
||||
, "hurricane"
|
||||
|
|
|
@ -150,8 +150,9 @@ class Builder:
|
|||
|
||||
|
||||
def _build ( self, tool ):
|
||||
toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() )
|
||||
toolBuildDir = os.path.join ( self.buildDir , tool.name )
|
||||
toolSourceDir = os.path.join ( self.sourceDir, tool.getToolDir() )
|
||||
toolBuildDir = os.path.join ( self.buildDir , tool.name )
|
||||
cmakeInstallDir = os.path.join ( self.installDir, "share", "cmake", "Modules" )
|
||||
# Supplied directly in the CMakeLists.txt.
|
||||
#cmakeModules = os.path.join ( self.installDir, "share", "cmake", "Modules" )
|
||||
|
||||
|
@ -170,8 +171,10 @@ class Builder:
|
|||
if self._qt5: command += [ "-D", "WITH_QT5:STRING=TRUE" ]
|
||||
if self._openmp: command += [ "-D", "WITH_OPENMP:STRING=TRUE" ]
|
||||
|
||||
command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode
|
||||
, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared
|
||||
command += [ "-D", "CMAKE_BUILD_TYPE:STRING=%s" % self.buildMode
|
||||
, "-D", "BUILD_SHARED_LIBS:STRING=%s" % self.enableShared
|
||||
, "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir
|
||||
, "-D", "CMAKE_INSTALL_DIR:STRING=%s" % cmakeInstallDir
|
||||
#, "-D", "CMAKE_MODULE_PATH:STRING=%s" % cmakeModules
|
||||
, toolSourceDir ]
|
||||
|
||||
|
@ -191,6 +194,7 @@ class Builder:
|
|||
, "-D", "CHECK_DETERMINISM:STRING=%s" % self._checkDeterminism
|
||||
, "-D", "CMAKE_VERBOSE_MAKEFILE:STRING=%s" % self._verboseMakefile
|
||||
, "-D", "CMAKE_INSTALL_PREFIX:STRING=%s" % self.installDir
|
||||
, "-D", "CMAKE_INSTALL_DIR:STRING=%s" % cmakeInstallDir
|
||||
]
|
||||
if self.libSuffix:
|
||||
command += [ "-D", "LIB_SUFFIX:STRING=%s" % self.libSuffix ]
|
||||
|
|
|
@ -11,6 +11,7 @@ cellsTop = allianceTop+'/cells/'
|
|||
allianceConfig = \
|
||||
( ( 'CATALOG' , 'CATAL')
|
||||
, ( 'WORKING_LIBRARY' , '.')
|
||||
# , ( 'SYSTEM_LIBRARY' , ( (cellsTop+'ramlib' , AddMode.Append), ) )
|
||||
, ( 'SYSTEM_LIBRARY' , ( (cellsTop+'sxlib' , AddMode.Append)
|
||||
, (cellsTop+'dp_sxlib', AddMode.Append)
|
||||
, (cellsTop+'ramlib' , AddMode.Append)
|
||||
|
|
|
@ -226,6 +226,7 @@ namespace CRL {
|
|||
Catalog* catalog = AllianceFramework::get()->getCatalog();
|
||||
CellLoaders* loaders = CellLoaders::get();
|
||||
|
||||
getCellsDatas().clear();
|
||||
forEach ( Cell*, icell, library->getLibrary()->getCells() ) {
|
||||
CellDatas* datas = new CellDatas(*icell);
|
||||
getCellsDatas().push_back( datas );
|
||||
|
@ -245,6 +246,7 @@ namespace CRL {
|
|||
CellDatas* key = new CellDatas( cellName );
|
||||
|
||||
auto idatas = lower_bound( getCellsDatas().begin(), getCellsDatas().end(), key, LessCellDatas );
|
||||
|
||||
if ( (idatas == getCellsDatas().end())
|
||||
or ((*idatas)->getName() != cellName ) ) {
|
||||
getCellsDatas().push_back( key );
|
||||
|
|
|
@ -86,6 +86,10 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void CellsWidget::updateLibrary ()
|
||||
{ _baseModel->updateLibrary(); }
|
||||
|
||||
|
||||
void CellsWidget::updateSelected ()
|
||||
{ if (_selected.isValid()) _baseModel->emitDataChanged(_selected); }
|
||||
|
||||
|
|
|
@ -139,5 +139,8 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void LibraryManager::updateLibrary ( Cell* )
|
||||
{ _cellsWidget->updateLibrary(); }
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
|
|
@ -60,7 +60,9 @@ namespace CRL {
|
|||
};
|
||||
|
||||
|
||||
inline const AllianceLibrary* CellsModel::getLibrary () const { return (const AllianceLibrary*)_ilibrary->first; }
|
||||
inline const AllianceLibrary* CellsModel::getLibrary () const
|
||||
{ return (_ilibrary != _libraries.end()) ? (const AllianceLibrary*)_ilibrary->first : NULL; }
|
||||
|
||||
inline const std::vector<CellDatas*>& CellsModel::getCellsDatas () const { return _ilibrary->second; }
|
||||
inline std::vector<CellDatas*>& CellsModel::getCellsDatas () { return _ilibrary->second; }
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace CRL {
|
|||
void selectedCell ( CellDatas* );
|
||||
public slots:
|
||||
void updateSelected ();
|
||||
void updateLibrary ();
|
||||
void selectCurrent ( const QModelIndex& index, const QModelIndex& );
|
||||
void setLibrary ( const AllianceLibrary* );
|
||||
private:
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace CRL {
|
|||
void toggleShow ();
|
||||
void setLibrary ( const AllianceLibrary* library );
|
||||
CellViewer* openCell ( Cell*, unsigned int flags );
|
||||
void updateLibrary ( Cell* );
|
||||
private:
|
||||
LibrariesWidget* _librariesWidget;
|
||||
CellsWidget* _cellsWidget;
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include "vlsisapd/utilities/Path.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/Instance.h"
|
||||
|
@ -35,10 +36,14 @@
|
|||
namespace CRL {
|
||||
|
||||
using namespace std::placeholders;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::JsonArray;
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::Graphics;
|
||||
using Hurricane::ForEachIterator;
|
||||
using Hurricane::getCollection;
|
||||
using Hurricane::Instance;
|
||||
using Hurricane::PrivateProperty;
|
||||
|
||||
|
@ -53,6 +58,8 @@ namespace CRL {
|
|||
static Name getPropertyName ();
|
||||
virtual Name getName () const;
|
||||
inline AllianceFramework* getFramework () const;
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter*, const DBo* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual Record* _getRecord () const;
|
||||
private:
|
||||
|
@ -60,10 +67,19 @@ namespace CRL {
|
|||
AllianceFramework* _framework;
|
||||
private:
|
||||
inline AllianceFrameworkProperty ( AllianceFramework* );
|
||||
public:
|
||||
class JsonProperty : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonProperty ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonProperty* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Name AllianceFrameworkProperty::_name = "AllianceFramework";
|
||||
Name AllianceFrameworkProperty::_name = "AllianceFrameworkProperty";
|
||||
|
||||
|
||||
inline AllianceFrameworkProperty::AllianceFrameworkProperty ( AllianceFramework* af )
|
||||
|
@ -107,6 +123,56 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
bool AllianceFrameworkProperty::hasJson () const
|
||||
{ return true; }
|
||||
|
||||
|
||||
void AllianceFrameworkProperty::toJson ( JsonWriter* w, const DBo* ) const
|
||||
{
|
||||
w->startObject();
|
||||
std::string tname = getString(getPropertyName());
|
||||
jsonWrite( w, "@typename" , tname );
|
||||
jsonWrite( w, "_framework", _framework );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
Initializer<AllianceFrameworkProperty::JsonProperty> jsonFrameworkPropertyInit ( 20 );
|
||||
|
||||
|
||||
AllianceFrameworkProperty::JsonProperty::JsonProperty ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_framework", typeid(AllianceFramework*) );
|
||||
}
|
||||
|
||||
|
||||
string AllianceFrameworkProperty::JsonProperty::getTypeName () const
|
||||
{ return getString(AllianceFrameworkProperty::getPropertyName()); }
|
||||
|
||||
|
||||
void AllianceFrameworkProperty::JsonProperty::initialize ()
|
||||
{ JsonTypes::registerType( new JsonProperty (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
AllianceFrameworkProperty::JsonProperty* AllianceFrameworkProperty::JsonProperty::clone ( unsigned long flags ) const
|
||||
{ return new JsonProperty ( flags ); }
|
||||
|
||||
|
||||
void AllianceFrameworkProperty::JsonProperty::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "AllianceFrameworkProperty::JsonProperty::toData" );
|
||||
|
||||
DBo* dbo = stack.back_dbo();
|
||||
AllianceFramework* framework = get<AllianceFramework*>(stack,"_framework");
|
||||
AllianceFrameworkProperty* property
|
||||
= AllianceFrameworkProperty::create(framework);
|
||||
if (dbo) dbo->put( property );
|
||||
|
||||
update( stack, property );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::AllianceFramework".
|
||||
|
||||
|
@ -173,7 +239,7 @@ namespace CRL {
|
|||
void AllianceFramework::_bindLibraries ()
|
||||
{
|
||||
DataBase* db = DataBase::getDB ();
|
||||
unsigned int flags = InSearchPath;
|
||||
unsigned int flags = AppendLibrary;
|
||||
SearchPath& LIBRARIES = _environment.getLIBRARIES ();
|
||||
Library* rootLibrary = db->getRootLibrary ();
|
||||
|
||||
|
@ -239,7 +305,7 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
AllianceLibrary* AllianceFramework::getAllianceLibrary ( const Name &libName, unsigned int& flags )
|
||||
AllianceLibrary* AllianceFramework::getAllianceLibrary ( const Name &libName, unsigned int flags )
|
||||
{
|
||||
for ( size_t ilib=0 ; ilib<_libraries.size() ; ++ilib ) {
|
||||
if ( _libraries[ilib]->getLibrary()->getName() == libName )
|
||||
|
@ -331,7 +397,7 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
AllianceLibrary* AllianceFramework::createLibrary ( const string& path, unsigned int& flags, string libName )
|
||||
AllianceLibrary* AllianceFramework::createLibrary ( const string& path, unsigned int flags, string libName )
|
||||
{
|
||||
if ( libName.empty() ) libName = SearchPath::extractLibName(path);
|
||||
|
||||
|
@ -339,7 +405,7 @@ namespace CRL {
|
|||
|
||||
string dupLibName = libName;
|
||||
for ( size_t duplicate=1 ; true ; ++duplicate ) {
|
||||
AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags );
|
||||
AllianceLibrary* library = getAllianceLibrary ( dupLibName, flags & ~CreateLibrary );
|
||||
if (library == NULL) break;
|
||||
|
||||
ostringstream oss;
|
||||
|
@ -355,31 +421,38 @@ namespace CRL {
|
|||
// }
|
||||
|
||||
SearchPath& LIBRARIES = _environment.getLIBRARIES ();
|
||||
if ( not (flags & InSearchPath) ) LIBRARIES.prepend ( path, dupLibName );
|
||||
else LIBRARIES.select ( path );
|
||||
if ( not (flags & AppendLibrary) ) LIBRARIES.prepend ( path, dupLibName );
|
||||
else LIBRARIES.select ( path );
|
||||
|
||||
AllianceLibrary* library = new AllianceLibrary ( path, Library::create(getParentLibrary(),dupLibName) );
|
||||
Library* hlibrary = getParentLibrary()->getLibrary( dupLibName );
|
||||
if (not hlibrary)
|
||||
hlibrary = Library::create( getParentLibrary(), dupLibName );
|
||||
|
||||
AllianceLibrary* alibrary = new AllianceLibrary ( path, hlibrary );
|
||||
|
||||
AllianceLibraries::iterator ilib = _libraries.begin();
|
||||
for ( size_t i=0 ; i<LIBRARIES.getIndex() ; ++i, ++ilib );
|
||||
if (LIBRARIES.getIndex() != SearchPath::npos)
|
||||
for ( size_t i=0 ; i<LIBRARIES.getIndex() ; ++i, ++ilib );
|
||||
else
|
||||
ilib = _libraries.end();
|
||||
|
||||
_libraries.insert ( ilib, library );
|
||||
_libraries.insert ( ilib, alibrary );
|
||||
|
||||
string catalog = path + "/" + _environment.getCATALOG();
|
||||
|
||||
if ( _catalog.loadFromFile(catalog,library->getLibrary()) ) flags |= HasCatalog;
|
||||
if ( _catalog.loadFromFile(catalog,alibrary->getLibrary()) ) flags |= HasCatalog;
|
||||
|
||||
ParserFormatSlot& parser = _parsers.getParserSlot ( path, Catalog::State::Physical, _environment );
|
||||
|
||||
if ( not parser.loadByLib() ) return library;
|
||||
if ( not parser.loadByLib() ) return alibrary;
|
||||
|
||||
// Load the whole library.
|
||||
if ( ! _readLocate(dupLibName,Catalog::State::State::Logical,true) ) return library;
|
||||
if ( ! _readLocate(dupLibName,Catalog::State::State::Logical,true) ) return alibrary;
|
||||
|
||||
// Call the parser function.
|
||||
(parser.getParsLib())( _environment.getLIBRARIES().getSelected() , library->getLibrary() , _catalog );
|
||||
(parser.getParsLib())( _environment.getLIBRARIES().getSelected() , alibrary->getLibrary() , _catalog );
|
||||
|
||||
return library;
|
||||
return alibrary;
|
||||
}
|
||||
|
||||
|
||||
|
@ -673,4 +746,53 @@ 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...
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::JsonAllianceFramework".
|
||||
|
||||
Initializer<JsonAllianceFramework> jsonFrameworkInit ( 20 );
|
||||
|
||||
|
||||
JsonAllianceFramework::JsonAllianceFramework (unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
// Environement & Catalog...
|
||||
add( "_environment", typeid(Environment*) );
|
||||
add( "+libraries" , typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
||||
string JsonAllianceFramework::getTypeName () const
|
||||
{ return "AllianceFramework"; }
|
||||
|
||||
|
||||
void JsonAllianceFramework::initialize ()
|
||||
{ JsonTypes::registerType( new JsonAllianceFramework (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonAllianceFramework* JsonAllianceFramework::clone ( unsigned long flags ) const
|
||||
{ return new JsonAllianceFramework ( flags ); }
|
||||
|
||||
|
||||
void JsonAllianceFramework::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonAllianceFramework::toData" );
|
||||
|
||||
// It's a singleton. Do not create it...
|
||||
AllianceFramework* framework = AllianceFramework::get();
|
||||
|
||||
update( stack, framework );
|
||||
}
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -1,67 +1,38 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Project.
|
||||
// Copyright (C) Laboratoire LIP6 - Departement ASIM
|
||||
// Universite Pierre et Marie Curie
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2008-2015, All Rights Reserved
|
||||
//
|
||||
// Main contributors :
|
||||
// Christophe Alexandre <Christophe.Alexandre@lip6.fr>
|
||||
// Sophie Belloeil <Sophie.Belloeil@lip6.fr>
|
||||
// Hugo Clément <Hugo.Clement@lip6.fr>
|
||||
// Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr>
|
||||
// Damien Dupuis <Damien.Dupuis@lip6.fr>
|
||||
// Christian Masson <Christian.Masson@lip6.fr>
|
||||
// Marek Sroka <Marek.Sroka@lip6.fr>
|
||||
//
|
||||
// The Coriolis Project is free software; you can redistribute it
|
||||
// and/or modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// The Coriolis Project is distributed in the hope that it will be
|
||||
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Coriolis Project; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA
|
||||
//
|
||||
// License-Tag
|
||||
// Authors-Tag
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// +-----------------------------------------------------------------+
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Rémy Escassut |
|
||||
// | E-mail : Remy.Escassut@silvaco.com |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./AllianceLibrary.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
|
||||
# include "hurricane/Library.h"
|
||||
|
||||
# include "crlcore/Utilities.h"
|
||||
# include "crlcore/AllianceLibrary.h"
|
||||
// | C++ Module : "./AllianceLibrary.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/SharedPath.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "crlcore/Utilities.h"
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::Name;
|
||||
using Hurricane::SharedPath;
|
||||
using Hurricane::DataBase;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "AllianceDirectory".
|
||||
|
@ -113,6 +84,89 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void AllianceLibrary::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", _getTypeName() );
|
||||
jsonWrite( w, "_path" , _path );
|
||||
jsonWrite( w, "_library" , _library->getHierarchicalName() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonAllianceLibrary".
|
||||
|
||||
Initializer<JsonAllianceLibrary> jsonAllianceLibraryInit ( 0 );
|
||||
|
||||
|
||||
void JsonAllianceLibrary::initialize ()
|
||||
{ JsonTypes::registerType( new JsonAllianceLibrary (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonAllianceLibrary::JsonAllianceLibrary ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_path" , typeid(string) );
|
||||
add( "_library", typeid(string) );
|
||||
}
|
||||
|
||||
string JsonAllianceLibrary::getTypeName () const
|
||||
{ return "AllianceLibrary"; }
|
||||
|
||||
|
||||
JsonAllianceLibrary* JsonAllianceLibrary::clone ( unsigned long flags ) const
|
||||
{ return new JsonAllianceLibrary ( flags ); }
|
||||
|
||||
|
||||
void JsonAllianceLibrary::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonAllianceLibrary::toData" );
|
||||
|
||||
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;
|
||||
|
||||
if (library) {
|
||||
aLibrary = af->getAllianceLibrary( library );
|
||||
}
|
||||
if (not aLibrary) {
|
||||
char separator = SharedPath::getNameSeparator();
|
||||
size_t dot = libDbPath.rfind( separator );
|
||||
Name libName = libDbPath.substr(dot+1);
|
||||
aLibrary = af->getAllianceLibrary( libName, AllianceFramework::AppendLibrary );
|
||||
|
||||
if (not aLibrary) {
|
||||
aLibrary = af->getAllianceLibrary( libOsPath
|
||||
, AllianceFramework::CreateLibrary
|
||||
| AllianceFramework::AppendLibrary );
|
||||
}
|
||||
if (not library) library = aLibrary->getLibrary();
|
||||
}
|
||||
|
||||
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)"
|
||||
, getString(library->getName()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
if (aLibrary->getPath() != Name(libOsPath)) {
|
||||
cerr << Warning( "JsonAllianceLibrary::toData(): Underlying OS path discrepency for \"%s\":\n"
|
||||
" - Blob: %s\n"
|
||||
" - System: %s"
|
||||
, getString(library->getName()).c_str()
|
||||
, libOsPath.c_str()
|
||||
, getString(aLibrary->getPath()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
|
||||
update( stack, aLibrary );
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -17,15 +17,25 @@
|
|||
# include <iomanip>
|
||||
using namespace std;
|
||||
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/SharedPath.h"
|
||||
#include "hurricane/Collection.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Name.h"
|
||||
#include "crlcore/Utilities.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::inltrace;
|
||||
using Hurricane::tab;
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::JsonTypes;
|
||||
using Hurricane::SharedPath;
|
||||
using Hurricane::DataBase;
|
||||
|
||||
const char* MissingStateProperty = "%s:\n\n Missing Catalog State Property in cell \"%s\".\n";
|
||||
|
||||
|
@ -89,6 +99,81 @@ namespace CRL {
|
|||
return record;
|
||||
}
|
||||
|
||||
|
||||
void Catalog::State::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", _getTypeName() );
|
||||
jsonWrite( w, "_flags" , _getString() );
|
||||
jsonWrite( w, "_depth" , _depth );
|
||||
|
||||
string cellName = "";
|
||||
if (_cell) cellName = getString( _cell->getHierarchicalName() );
|
||||
jsonWrite( w, "_cell", cellName );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
Initializer<Catalog::State::JsonState> jsonCatalogStateInit ( 20 );
|
||||
|
||||
|
||||
Catalog::State::JsonState::JsonState ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_flags", typeid(string) );
|
||||
add( "_depth", typeid(int64_t) );
|
||||
add( "_cell" , typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
string Catalog::State::JsonState::getTypeName () const
|
||||
{ return "Catalog::State"; }
|
||||
|
||||
|
||||
void Catalog::State::JsonState::initialize ()
|
||||
{ JsonTypes::registerType( new JsonState (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
Catalog::State::JsonState* Catalog::State::JsonState::clone ( unsigned long flags ) const
|
||||
{ return new JsonState ( flags ); }
|
||||
|
||||
|
||||
void Catalog::State::JsonState::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "Catalog::State::JsonState::toData" );
|
||||
|
||||
string cellPath = get<string> ( stack, "_cell" );
|
||||
string sflags = get<string> ( stack, "_flags" );
|
||||
unsigned int depth = get<int64_t>( stack, "_depth" );
|
||||
|
||||
char separator = SharedPath::getNameSeparator();
|
||||
size_t dot = cellPath.rfind( separator );
|
||||
string cellName = cellPath.substr(dot+1);
|
||||
string libraryName = cellPath.substr(0,dot);
|
||||
|
||||
Library* library = DataBase::getDB()->getLibrary( libraryName
|
||||
, DataBase::CreateLib|DataBase::WarnCreateLib );
|
||||
Cell* cell = library->getCell( cellName );
|
||||
|
||||
Catalog* catalog = AllianceFramework::get()->getCatalog();
|
||||
Catalog::State* state = catalog->getState( cellName );
|
||||
|
||||
if (not state) state = catalog->getState( cellName, true );
|
||||
if (state->getCell () != cell ) state->setCell ( cell );
|
||||
if (state->getLibrary() != library) state->setLibrary( library );
|
||||
|
||||
state->setDepth( depth );
|
||||
state->setFlattenLeaf( (sflags[0] == 'C') );
|
||||
state->setFeed( (sflags[1] == 'F') );
|
||||
state->setPad( (sflags[2] == 'P') );
|
||||
state->setGds( (sflags[3] == 'G') );
|
||||
state->setDelete( (sflags[4] == 'D') );
|
||||
state->setInMemory( (sflags[5] == 'm') );
|
||||
|
||||
update( stack, state );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Catalog".
|
||||
|
||||
|
@ -248,8 +333,7 @@ namespace CRL {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "CatalogProperty"
|
||||
|
||||
|
||||
Name CatalogProperty::_name = "Alliance Catalog State";
|
||||
Name CatalogProperty::_name = "Catalog::State::Property";
|
||||
|
||||
|
||||
CatalogProperty* CatalogProperty::create ( Catalog::State* state )
|
||||
|
@ -306,6 +390,76 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
bool CatalogProperty::hasJson () const
|
||||
{ return true; }
|
||||
|
||||
|
||||
void CatalogProperty::toJson ( JsonWriter* w, const DBo* ) const
|
||||
{
|
||||
w->startObject();
|
||||
std::string tname = getString(getPropertyName());
|
||||
jsonWrite( w, "@typename", tname );
|
||||
jsonWrite( w, "_state" , _state );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonCatalogProperty"
|
||||
|
||||
Initializer<JsonCatalogProperty> jsonCatalogPropertyInit ( 20 );
|
||||
|
||||
|
||||
JsonCatalogProperty::JsonCatalogProperty ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_state", typeid(Catalog::State*) );
|
||||
}
|
||||
|
||||
|
||||
string JsonCatalogProperty::getTypeName () const
|
||||
{ return getString(CatalogProperty::getPropertyName()); }
|
||||
|
||||
|
||||
void JsonCatalogProperty::initialize ()
|
||||
{ JsonTypes::registerType( new JsonCatalogProperty (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonCatalogProperty* JsonCatalogProperty::clone ( unsigned long flags ) const
|
||||
{ return new JsonCatalogProperty ( flags ); }
|
||||
|
||||
|
||||
void JsonCatalogProperty::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonCatalogProperty::toData" );
|
||||
|
||||
DBo* dbo = stack.back_dbo();
|
||||
Catalog::State* state = get<Catalog::State*>( stack, "_state" );
|
||||
CatalogProperty* property = NULL;
|
||||
|
||||
ltrace(51) << "topDBo:" << dbo << endl;
|
||||
|
||||
Cell* cell = dynamic_cast<Cell*>( dbo );
|
||||
if (cell) {
|
||||
Property* base = cell->getProperty( CatalogProperty::getPropertyName() );
|
||||
if (base) {
|
||||
property = static_cast<CatalogProperty*>( base );
|
||||
if (property->getState() != state) {
|
||||
cerr << Error( "JsonCatalogProperty::toData(): State object incoherency on Cell \"%s\"."
|
||||
, getString(cell->getName()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
property = CatalogProperty::create( state );
|
||||
cell->put( property );
|
||||
}
|
||||
}
|
||||
// NULL Cell means we are parsing the Catalog.
|
||||
|
||||
update( stack, property );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CatalogExtension"
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "crlcore/Utilities.h"
|
||||
#include "crlcore/XmlParser.h"
|
||||
#include "crlcore/Environment.h"
|
||||
#include "crlcore/AllianceFramework.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -505,6 +506,12 @@ namespace {
|
|||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::Initializer;
|
||||
using Hurricane::JsonTypes;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Environment".
|
||||
|
||||
Environment::Environment ()
|
||||
: _CORIOLIS_TOP (CORIOLIS_TOP)
|
||||
|
@ -753,4 +760,83 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void Environment::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename" , _getTypeName() );
|
||||
jsonWrite( w, "_CORIOLIS_TOP", _CORIOLIS_TOP );
|
||||
jsonWrite( w, "_displayStyle", _displayStyle );
|
||||
jsonWrite( w, "_SCALE_X" , _SCALE_X );
|
||||
jsonWrite( w, "_IN_LO" , _IN_LO );
|
||||
jsonWrite( w, "_IN_PH" , _IN_PH );
|
||||
jsonWrite( w, "_OUT_LO" , _OUT_LO );
|
||||
jsonWrite( w, "_OUT_PH" , _OUT_PH );
|
||||
jsonWrite( w, "_POWER" , _POWER );
|
||||
jsonWrite( w, "_GROUND" , _GROUND );
|
||||
jsonWrite( w, "_CLOCK" , _CLOCK );
|
||||
jsonWrite( w, "_BLOCKAGE" , _BLOCKAGE );
|
||||
jsonWrite( w, "_pad" , _pad );
|
||||
jsonWrite( w, "_CATALOG" , _CATALOG );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonEnvironment".
|
||||
|
||||
Initializer<JsonEnvironment> jsonEnvironmentInit ( 0 );
|
||||
|
||||
|
||||
void JsonEnvironment::initialize ()
|
||||
{ JsonTypes::registerType( new JsonEnvironment (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonEnvironment::JsonEnvironment ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_CORIOLIS_TOP", typeid(string) );
|
||||
add( "_displayStyle", typeid(string) );
|
||||
add( "_SCALE_X" , typeid(int64_t) );
|
||||
add( "_IN_LO" , typeid(string) );
|
||||
add( "_IN_PH" , typeid(string) );
|
||||
add( "_OUT_LO" , typeid(string) );
|
||||
add( "_OUT_PH" , typeid(string) );
|
||||
add( "_POWER" , typeid(string) );
|
||||
add( "_GROUND" , typeid(string) );
|
||||
add( "_BLOCKAGE" , typeid(string) );
|
||||
add( "_pad" , typeid(string) );
|
||||
add( "_CATALOG" , typeid(string) );
|
||||
add( "_CLOCK" , typeid(string) );
|
||||
}
|
||||
|
||||
string JsonEnvironment::getTypeName () const
|
||||
{ return "Environment"; }
|
||||
|
||||
|
||||
JsonEnvironment* JsonEnvironment::clone ( unsigned long flags ) const
|
||||
{ return new JsonEnvironment ( flags ); }
|
||||
|
||||
|
||||
void JsonEnvironment::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonEnvironment::toData" );
|
||||
|
||||
Environment* environement = AllianceFramework::get()->getEnvironment();
|
||||
environement->setDisplayStyle( get<string> (stack,"_displayStyle").c_str() );
|
||||
environement->setSCALE_X ( get<int64_t>(stack,"_SCALE_X" ) );
|
||||
environement->setIN_LO ( get<string> (stack,"_IN_LO" ).c_str() );
|
||||
environement->setIN_PH ( get<string> (stack,"_IN_PH" ).c_str() );
|
||||
environement->setOUT_LO ( get<string> (stack,"_OUT_LO" ).c_str() );
|
||||
environement->setOUT_PH ( get<string> (stack,"_OUT_PH" ).c_str() );
|
||||
environement->setPOWER ( get<string> (stack,"_POWER" ).c_str() );
|
||||
environement->setGROUND ( get<string> (stack,"_GROUND" ).c_str() );
|
||||
environement->setCLOCK ( get<string> (stack,"_CLOCK" ).c_str() );
|
||||
environement->setBLOCKAGE ( get<string> (stack,"_BLOCKAGE" ).c_str() );
|
||||
environement->setPad ( get<string> (stack,"_pad" ).c_str() );
|
||||
environement->setCATALOG ( get<string> (stack,"_CATALOG" ).c_str() );
|
||||
|
||||
update( stack, environement );
|
||||
}
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
|
@ -18,17 +17,19 @@
|
|||
#ifndef CRL_ALLIANCE_FRAMEWORK_H
|
||||
#define CRL_ALLIANCE_FRAMEWORK_H
|
||||
|
||||
#include <map>
|
||||
#include <limits>
|
||||
#include "hurricane/Cell.h"
|
||||
#include "crlcore/Environment.h"
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/ParsersDrivers.h"
|
||||
#include <map>
|
||||
#include <limits>
|
||||
#include "hurricane/Cell.h"
|
||||
#include "crlcore/Environment.h"
|
||||
#include "crlcore/AllianceLibrary.h"
|
||||
#include "crlcore/Catalog.h"
|
||||
#include "crlcore/ParsersDrivers.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Cell;
|
||||
using Hurricane::Net;
|
||||
class RoutingGauge;
|
||||
|
@ -37,8 +38,13 @@ namespace CRL {
|
|||
|
||||
class AllianceFramework {
|
||||
public:
|
||||
enum InstancesCountFlags { Recursive=0x1, IgnoreFeeds=0x2 };
|
||||
enum LibraryFlags { CreateLibrary=0x1, InSearchPath=0x2, HasCatalog=0x4 };
|
||||
enum InstancesCountFlags { Recursive = (1<<0)
|
||||
, IgnoreFeeds = (1<<1)
|
||||
};
|
||||
enum LibraryFlags { CreateLibrary = (1<<0)
|
||||
, AppendLibrary = (1<<1)
|
||||
, HasCatalog = (1<<2)
|
||||
};
|
||||
public:
|
||||
// Constructors.
|
||||
static AllianceFramework* create ();
|
||||
|
@ -72,9 +78,9 @@ namespace CRL {
|
|||
inline Library* getParentLibrary ();
|
||||
Library* getLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( unsigned int index );
|
||||
AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int& flags );
|
||||
AllianceLibrary* getAllianceLibrary ( const Name& libName, unsigned int flags );
|
||||
AllianceLibrary* getAllianceLibrary ( Library* );
|
||||
AllianceLibrary* createLibrary ( const string& path, unsigned int& flags, string libName="" );
|
||||
AllianceLibrary* createLibrary ( const string& path, unsigned int flags, string libName="" );
|
||||
inline const AllianceLibraries& getAllianceLibraries () const;
|
||||
void saveLibrary ( Library* );
|
||||
void saveLibrary ( AllianceLibrary* );
|
||||
|
@ -95,6 +101,7 @@ namespace CRL {
|
|||
unsigned int loadLibraryCells ( const Name& );
|
||||
static size_t getInstancesCount ( Cell*, unsigned int flags );
|
||||
// Hurricane Managment.
|
||||
void toJson ( JsonWriter* ) const;
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
@ -159,6 +166,16 @@ namespace CRL {
|
|||
inline string AllianceFramework::_getTypeName () const { return "AllianceFramework"; }
|
||||
|
||||
|
||||
class JsonAllianceFramework : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonAllianceFramework( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonAllianceFramework* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace Hurricane {
|
|||
namespace CRL {
|
||||
|
||||
using std::vector;
|
||||
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::Name;
|
||||
using Hurricane::Library;
|
||||
using Hurricane::Record;
|
||||
|
@ -53,6 +54,7 @@ namespace CRL {
|
|||
inline const Name& getPath () const;
|
||||
inline Library* getLibrary () const;
|
||||
// Hurricane management.
|
||||
void toJson ( JsonWriter* ) const;
|
||||
inline std::string _getTypeName () const;
|
||||
std::string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
@ -74,6 +76,19 @@ namespace CRL {
|
|||
inline std::string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonAllianceLibrary".
|
||||
|
||||
class JsonAllianceLibrary : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonAllianceLibrary ( unsigned long flags );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonAllianceLibrary* clone ( unsigned long flags ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace CRL {
|
|||
|
||||
using std::string;
|
||||
using std::map;
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
using Hurricane::_TName;
|
||||
using Hurricane::Name;
|
||||
using Hurricane::Record;
|
||||
|
@ -106,6 +108,7 @@ namespace CRL {
|
|||
inline bool setDelete ( bool value );
|
||||
inline bool setPhysical ( bool value );
|
||||
inline bool setLogical ( bool value );
|
||||
inline bool setInMemory ( bool value );
|
||||
// Accessors.
|
||||
inline Cell* getCell () const;
|
||||
inline Library* getLibrary () const;
|
||||
|
@ -116,6 +119,7 @@ namespace CRL {
|
|||
inline Library* setLibrary ( Library* library );
|
||||
inline void setDepth ( unsigned int depth );
|
||||
// Hurricane Management.
|
||||
void toJson ( JsonWriter* w ) const;
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
@ -126,7 +130,18 @@ namespace CRL {
|
|||
unsigned int _depth;
|
||||
Cell* _cell;
|
||||
Library* _library;
|
||||
};
|
||||
|
||||
// Json Property.
|
||||
public:
|
||||
class JsonState : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonState ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonState* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
};
|
||||
|
||||
private:
|
||||
// Attributes.
|
||||
|
@ -142,7 +157,6 @@ namespace CRL {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::CatalogProperty".
|
||||
|
||||
|
||||
class CatalogProperty : public PrivateProperty {
|
||||
|
||||
public:
|
||||
|
@ -154,6 +168,8 @@ namespace CRL {
|
|||
inline Catalog::State* getState () const;
|
||||
inline void setState ( Catalog::State* state );
|
||||
virtual void onReleasedBy ( DBo* owner );
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter* w, const DBo* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
@ -168,6 +184,19 @@ namespace CRL {
|
|||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "CRL::JsonCatalogProperty".
|
||||
|
||||
class JsonCatalogProperty : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonCatalogProperty ( unsigned long );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonCatalogProperty* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Inline Functions.
|
||||
|
||||
|
@ -193,6 +222,7 @@ namespace CRL {
|
|||
inline bool Catalog::State::setDelete ( bool value ) { return setFlags(Delete ,value); }
|
||||
inline bool Catalog::State::setPhysical ( bool value ) { return setFlags(Physical ,value); }
|
||||
inline bool Catalog::State::setLogical ( bool value ) { return setFlags(Logical ,value); }
|
||||
inline bool Catalog::State::setInMemory ( bool value ) { return setFlags(InMemory ,value); }
|
||||
inline Library* Catalog::State::setLibrary ( Library* library ) { return _library = library; }
|
||||
inline void Catalog::State::setDepth ( unsigned int depth ) { _depth = depth; }
|
||||
inline Cell* Catalog::State::getCell () const { return _cell; }
|
||||
|
|
|
@ -19,11 +19,18 @@
|
|||
|
||||
#include <regex.h>
|
||||
#include <string>
|
||||
#include <crlcore/SearchPath.h>
|
||||
#include "hurricane/Commons.h"
|
||||
#include "crlcore/SearchPath.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
using Hurricane::JsonObject;
|
||||
using Hurricane::JsonStack;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Environment".
|
||||
|
||||
class Environment {
|
||||
public:
|
||||
|
@ -76,6 +83,7 @@ namespace CRL {
|
|||
void addSYSTEM_LIBRARY ( const char* value, const char* libName, unsigned int mode=Append );
|
||||
// Methods.
|
||||
std::string getPrint () const;
|
||||
void toJson ( JsonWriter* ) const;
|
||||
inline std::string _getTypeName () const;
|
||||
std::string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
@ -134,6 +142,19 @@ namespace CRL {
|
|||
inline std::string Environment::_getTypeName () const { return "Environment"; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonEnvironment".
|
||||
|
||||
class JsonEnvironment : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonEnvironment ( unsigned long flags );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonEnvironment* clone ( unsigned long flags ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
} // CRL namespace.
|
||||
|
||||
|
||||
|
|
|
@ -41,79 +41,80 @@
|
|||
<li><a class="reference internal" href="#release-1-0-1963" id="id15">Release 1.0.1963</a></li>
|
||||
<li><a class="reference internal" href="#release-1-0-2049" id="id16">Release 1.0.2049</a></li>
|
||||
<li><a class="reference internal" href="#release-v2-0-1" id="id17">Release v2.0.1</a></li>
|
||||
<li><a class="reference internal" href="#release-v2-1" id="id18"><strong>Release v2.1</strong></a></li>
|
||||
<li><a class="reference internal" href="#release-v2-1" id="id18">Release v2.1</a></li>
|
||||
<li><a class="reference internal" href="#release-v2-2" id="id19"><strong>Release v2.2</strong></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#installation" id="id19">Installation</a><ul>
|
||||
<li><a class="reference internal" href="#fixed-directory-tree" id="id20">Fixed Directory Tree</a></li>
|
||||
<li><a class="reference internal" href="#building-coriolis" id="id21">Building Coriolis</a><ul>
|
||||
<li><a class="reference internal" href="#building-the-devel-branch" id="id22">Building the Devel Branch</a></li>
|
||||
<li><a class="reference internal" href="#additionnal-requirement-under-macos" id="id23">Additionnal Requirement under <span class="sc">MacOS</span></a></li>
|
||||
<li><a class="reference internal" href="#installation" id="id20">Installation</a><ul>
|
||||
<li><a class="reference internal" href="#fixed-directory-tree" id="id21">Fixed Directory Tree</a></li>
|
||||
<li><a class="reference internal" href="#building-coriolis" id="id22">Building Coriolis</a><ul>
|
||||
<li><a class="reference internal" href="#building-the-devel-branch" id="id23">Building the Devel Branch</a></li>
|
||||
<li><a class="reference internal" href="#additionnal-requirement-under-macos" id="id24">Additionnal Requirement under <span class="sc">MacOS</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#packaging-coriolis" id="id24">Packaging Coriolis</a></li>
|
||||
<li><a class="reference internal" href="#hooking-up-into-alliance" id="id25">Hooking up into <span class="sc">Alliance</span></a></li>
|
||||
<li><a class="reference internal" href="#setting-up-the-environment-coriolisenv-py" id="id26">Setting up the Environment (coriolisEnv.py)</a></li>
|
||||
<li><a class="reference internal" href="#packaging-coriolis" id="id25">Packaging Coriolis</a></li>
|
||||
<li><a class="reference internal" href="#hooking-up-into-alliance" id="id26">Hooking up into <span class="sc">Alliance</span></a></li>
|
||||
<li><a class="reference internal" href="#setting-up-the-environment-coriolisenv-py" id="id27">Setting up the Environment (coriolisEnv.py)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#documentation" id="id27">Documentation</a><ul>
|
||||
<li><a class="reference internal" href="#general-software-architecture" id="id28">General Software Architecture</a></li>
|
||||
<li><a class="reference internal" href="#documentation" id="id28">Documentation</a><ul>
|
||||
<li><a class="reference internal" href="#general-software-architecture" id="id29">General Software Architecture</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#coriolis-configuration-initialisation" id="id29">Coriolis Configuration & Initialisation</a><ul>
|
||||
<li><a class="reference internal" href="#first-stage-symbolic-technology-selection" id="id30">First Stage: Symbolic Technology Selection</a></li>
|
||||
<li><a class="reference internal" href="#second-stage-technology-configuration-loading" id="id31">Second Stage: Technology Configuration Loading</a></li>
|
||||
<li><a class="reference internal" href="#configuration-helpers" id="id32">Configuration Helpers</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id33"><span class="sc">Alliance</span> Helper</a></li>
|
||||
<li><a class="reference internal" href="#tools-configuration-helpers" id="id34">Tools Configuration Helpers</a></li>
|
||||
<li><a class="reference internal" href="#coriolis-configuration-initialisation" id="id30">Coriolis Configuration & Initialisation</a><ul>
|
||||
<li><a class="reference internal" href="#first-stage-symbolic-technology-selection" id="id31">First Stage: Symbolic Technology Selection</a></li>
|
||||
<li><a class="reference internal" href="#second-stage-technology-configuration-loading" id="id32">Second Stage: Technology Configuration Loading</a></li>
|
||||
<li><a class="reference internal" href="#configuration-helpers" id="id33">Configuration Helpers</a><ul>
|
||||
<li><a class="reference internal" href="#id1" id="id34"><span class="sc">Alliance</span> Helper</a></li>
|
||||
<li><a class="reference internal" href="#tools-configuration-helpers" id="id35">Tools Configuration Helpers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#hacking-the-configuration-files" id="id35">Hacking the Configuration Files</a></li>
|
||||
<li><a class="reference internal" href="#hacking-the-configuration-files" id="id36">Hacking the Configuration Files</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#cgt-the-graphical-interface" id="id36">CGT - The Graphical Interface</a></li>
|
||||
<li><a class="reference internal" href="#id2" id="id37">Viewer & Tools</a><ul>
|
||||
<li><a class="reference internal" href="#stratus-netlist-capture" id="id38"><span class="sc">Stratus</span> Netlist Capture</a></li>
|
||||
<li><a class="reference internal" href="#the-hurricane-data-base" id="id39">The <span class="sc">Hurricane</span> Data-Base</a></li>
|
||||
<li><a class="reference internal" href="#synthetizing-and-loading-a-design" id="id40">Synthetizing and loading a design</a><ul>
|
||||
<li><a class="reference internal" href="#synthesis-under-yosys" id="id41">Synthesis under Yosys</a></li>
|
||||
<li><a class="reference internal" href="#synthesis-under-alliance" id="id42">Synthesis under Alliance</a></li>
|
||||
<li><a class="reference internal" href="#cgt-the-graphical-interface" id="id37">CGT - The Graphical Interface</a></li>
|
||||
<li><a class="reference internal" href="#id2" id="id38">Viewer & Tools</a><ul>
|
||||
<li><a class="reference internal" href="#stratus-netlist-capture" id="id39"><span class="sc">Stratus</span> Netlist Capture</a></li>
|
||||
<li><a class="reference internal" href="#the-hurricane-data-base" id="id40">The <span class="sc">Hurricane</span> Data-Base</a></li>
|
||||
<li><a class="reference internal" href="#synthetizing-and-loading-a-design" id="id41">Synthetizing and loading a design</a><ul>
|
||||
<li><a class="reference internal" href="#synthesis-under-yosys" id="id42">Synthesis under Yosys</a></li>
|
||||
<li><a class="reference internal" href="#synthesis-under-alliance" id="id43">Synthesis under Alliance</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#etesian-placer" id="id43">Etesian -- Placer</a><ul>
|
||||
<li><a class="reference internal" href="#etesian-configuration-parameters" id="id44">Etesian Configuration Parameters</a></li>
|
||||
<li><a class="reference internal" href="#etesian-placer" id="id44">Etesian -- Placer</a><ul>
|
||||
<li><a class="reference internal" href="#etesian-configuration-parameters" id="id45">Etesian Configuration Parameters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#knik-global-router" id="id45">Knik -- Global Router</a></li>
|
||||
<li><a class="reference internal" href="#kite-detailed-router" id="id46">Kite -- Detailed Router</a><ul>
|
||||
<li><a class="reference internal" href="#kite-configuration-parameters" id="id47">Kite Configuration Parameters</a></li>
|
||||
<li><a class="reference internal" href="#knik-global-router" id="id46">Knik -- Global Router</a></li>
|
||||
<li><a class="reference internal" href="#kite-detailed-router" id="id47">Kite -- Detailed Router</a><ul>
|
||||
<li><a class="reference internal" href="#kite-configuration-parameters" id="id48">Kite Configuration Parameters</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#executing-python-scripts-in-cgt" id="id48">Executing Python Scripts in Cgt</a></li>
|
||||
<li><a class="reference internal" href="#printing-snapshots" id="id49">Printing & Snapshots</a></li>
|
||||
<li><a class="reference internal" href="#memento-of-shortcuts-in-graphic-mode" id="id50">Memento of Shortcuts in Graphic Mode</a></li>
|
||||
<li><a class="reference internal" href="#cgt-command-line-options" id="id51">Cgt Command Line Options</a></li>
|
||||
<li><a class="reference internal" href="#miscellaneous-settings" id="id52">Miscellaneous Settings</a></li>
|
||||
<li><a class="reference internal" href="#executing-python-scripts-in-cgt" id="id49">Executing Python Scripts in Cgt</a></li>
|
||||
<li><a class="reference internal" href="#printing-snapshots" id="id50">Printing & Snapshots</a></li>
|
||||
<li><a class="reference internal" href="#memento-of-shortcuts-in-graphic-mode" id="id51">Memento of Shortcuts in Graphic Mode</a></li>
|
||||
<li><a class="reference internal" href="#cgt-command-line-options" id="id52">Cgt Command Line Options</a></li>
|
||||
<li><a class="reference internal" href="#miscellaneous-settings" id="id53">Miscellaneous Settings</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#id3" id="id53">The Controller</a><ul>
|
||||
<li><a class="reference internal" href="#id4" id="id54">The Look Tab</a></li>
|
||||
<li><a class="reference internal" href="#id5" id="id55">The Filter Tab</a></li>
|
||||
<li><a class="reference internal" href="#id6" id="id56">The Layers&Go Tab</a></li>
|
||||
<li><a class="reference internal" href="#id7" id="id57">The Netlist Tab</a></li>
|
||||
<li><a class="reference internal" href="#id8" id="id58">The Selection Tab</a></li>
|
||||
<li><a class="reference internal" href="#id9" id="id59">The Inspector Tab</a></li>
|
||||
<li><a class="reference internal" href="#id10" id="id60">The Settings Tab</a></li>
|
||||
<li><a class="reference internal" href="#id3" id="id54">The Controller</a><ul>
|
||||
<li><a class="reference internal" href="#id4" id="id55">The Look Tab</a></li>
|
||||
<li><a class="reference internal" href="#id5" id="id56">The Filter Tab</a></li>
|
||||
<li><a class="reference internal" href="#id6" id="id57">The Layers&Go Tab</a></li>
|
||||
<li><a class="reference internal" href="#id7" id="id58">The Netlist Tab</a></li>
|
||||
<li><a class="reference internal" href="#id8" id="id59">The Selection Tab</a></li>
|
||||
<li><a class="reference internal" href="#id9" id="id60">The Inspector Tab</a></li>
|
||||
<li><a class="reference internal" href="#id10" id="id61">The Settings Tab</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#python-interface-for-hurricane-coriolis" id="id61">Python Interface for <span class="sc">Hurricane</span> / <span class="sc">Coriolis</span></a></li>
|
||||
<li><a class="reference internal" href="#plugins" id="id62">Plugins</a><ul>
|
||||
<li><a class="reference internal" href="#chip-placement" id="id63">Chip Placement</a></li>
|
||||
<li><a class="reference internal" href="#clock-tree" id="id64">Clock Tree</a></li>
|
||||
<li><a class="reference internal" href="#recursive-save-rsave" id="id65">Recursive-Save (RSave)</a></li>
|
||||
<li><a class="reference internal" href="#python-interface-for-hurricane-coriolis" id="id62">Python Interface for <span class="sc">Hurricane</span> / <span class="sc">Coriolis</span></a></li>
|
||||
<li><a class="reference internal" href="#plugins" id="id63">Plugins</a><ul>
|
||||
<li><a class="reference internal" href="#chip-placement" id="id64">Chip Placement</a></li>
|
||||
<li><a class="reference internal" href="#clock-tree" id="id65">Clock Tree</a></li>
|
||||
<li><a class="reference internal" href="#recursive-save-rsave" id="id66">Recursive-Save (RSave)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#a-simple-example-am2901" id="id66">A Simple Example: AM2901</a></li>
|
||||
<li><a class="reference internal" href="#a-simple-example-am2901" id="id67">A Simple Example: AM2901</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -215,7 +216,7 @@ achieve a speedup factor greater than 20...</li>
|
|||
</ol>
|
||||
</div>
|
||||
<div class="section" id="release-v2-1">
|
||||
<h3><a class="toc-backref" href="#id18"><strong>Release v2.1</strong></a></h3>
|
||||
<h3><a class="toc-backref" href="#id18">Release v2.1</a></h3>
|
||||
<ol class="arabic simple">
|
||||
<li>Replace the old simulated annealing placer <span class="sc">Mauka</span> by the analytical placer
|
||||
<span class="sc">Etesian</span> and its legalization and detailed placement tools.</li>
|
||||
|
@ -229,11 +230,19 @@ is back from <tt class="docutils literal">.conf</tt> to <tt class="docutils lite
|
|||
<!-- When shifting to the left, the right-half part of the screen gets -->
|
||||
<!-- badly redrawn. Uses |CTRL_L| to refresh. It will be corrected as soon -->
|
||||
<!-- as possible. -->
|
||||
</div>
|
||||
<div class="section" id="release-v2-2">
|
||||
<h3><a class="toc-backref" href="#id19"><strong>Release v2.2</strong></a></h3>
|
||||
<ol class="arabic simple">
|
||||
<li>Added JSON import/export of the whole Hurricane DataBase. Two save mode
|
||||
are supported: <em>Cell</em> mode (standalone) or <em>Blob</em> mode, which dump the
|
||||
whole design down and including the standard cells.</li>
|
||||
</ol>
|
||||
<p><span class="raw-html"><hr></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="installation">
|
||||
<h2><a class="toc-backref" href="#id19">Installation</a></h2>
|
||||
<h2><a class="toc-backref" href="#id20">Installation</a></h2>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
<p class="last">As the sources are being released, the binary packaging is dropped.
|
||||
|
@ -245,9 +254,11 @@ running the <span class="cb">ccb</span> installer.</p>
|
|||
<ul class="simple">
|
||||
<li>cmake</li>
|
||||
<li>C++11-capable compiler</li>
|
||||
<li><a class="reference external" href="http://miloyip.github.io/rapidjson/">RapidJSON</a></li>
|
||||
<li>python2.7</li>
|
||||
<li>boost</li>
|
||||
<li>libxml2</li>
|
||||
<li>bzip2</li>
|
||||
<li>yacc & lex</li>
|
||||
<li>Qt 4 or Qt 5</li>
|
||||
</ul>
|
||||
|
@ -272,7 +283,7 @@ A repository of <span class="sc">coin-or</span> packages backported from <span c
|
|||
<p>For other distributions, refer to their own packaging system.</p>
|
||||
<p><span class="raw-html"><hr></span></p>
|
||||
<div class="section" id="fixed-directory-tree">
|
||||
<h3><a class="toc-backref" href="#id20">Fixed Directory Tree</a></h3>
|
||||
<h3><a class="toc-backref" href="#id21">Fixed Directory Tree</a></h3>
|
||||
<p>In order to simplificate the work of the <span class="cb">ccb</span> installer, the source, build
|
||||
and installation tree is fixed. To successfully compile <span class="sc">Coriolis</span> you must
|
||||
follow it exactly. The tree is relative to the home directory of the user
|
||||
|
@ -366,23 +377,30 @@ and Python modules (which must be dynamic).</p>
|
|||
<p><span class="raw-html"><hr></span></p>
|
||||
</div>
|
||||
<div class="section" id="building-coriolis">
|
||||
<h3><a class="toc-backref" href="#id21">Building Coriolis</a></h3>
|
||||
<p>The first step is to create the source directory and pull the <span class="cb">git</span> repository:</p>
|
||||
<h3><a class="toc-backref" href="#id22">Building Coriolis</a></h3>
|
||||
<p>First step is to install the prerequisites. Currently, only <a class="reference external" href="http://miloyip.github.io/rapidjson/">RapidJSON</a>:</p>
|
||||
<pre class="literal-block">
|
||||
dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src/support
|
||||
dummy@lepka:~$ git clone http://github.com/miloyip/rapidjson
|
||||
</pre>
|
||||
<p>The second step is to create the source directory and pull the <span class="cb">git</span> repository:</p>
|
||||
<pre class="literal-block">
|
||||
dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src
|
||||
dummy@lepka:~$ cd ~/coriolis-2.x/src
|
||||
dummy@lepka:~$ git clone https://www-soc.lip6.fr/git/coriolis.git
|
||||
</pre>
|
||||
<p>Second and final step, build & install:</p>
|
||||
<p>Third and final step, build & install:</p>
|
||||
<pre class="literal-block">
|
||||
dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \
|
||||
dummy@lepka:src$ ./bootstrap/ccp.py --project=support \
|
||||
--project=coriolis \
|
||||
--make="-j4 install"
|
||||
dummy@lepka:src$ ./bootstrap/ccb.py --project=coriolis \
|
||||
dummy@lepka:src$ ./bootstrap/ccb.py --project=support \
|
||||
--project=coriolis \
|
||||
--doc --make="-j1 install"
|
||||
</pre>
|
||||
<p>We need two steps because the documentation do not support to be generated with
|
||||
a parallel build. So we compile & install in a first step in <tt class="docutils literal"><span class="pre">-j4</span></tt> (or whatever)
|
||||
then we generate the documentation in <tt class="docutils literal"><span class="pre">-j1</span></tt></p>
|
||||
<p>We need to separate to perform a separate installation of the documentation because it
|
||||
do not support to be generated with a parallel build. So we compile & install in a first
|
||||
stage in <tt class="docutils literal"><span class="pre">-j4</span></tt> (or whatever) then we generate the documentation in <tt class="docutils literal"><span class="pre">-j1</span></tt></p>
|
||||
<p>Under <span class="sc">rhel6</span> or clones, you must build using the <span class="cb">devtoolset2</span>:</p>
|
||||
<pre class="literal-block">
|
||||
dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \
|
||||
|
@ -392,7 +410,7 @@ dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \
|
|||
<p>The complete list of <span class="cb">ccb</span> functionalities can be accessed with the <tt class="docutils literal"><span class="pre">--help</span></tt> argument.
|
||||
It also may be run in graphical mode (<tt class="docutils literal"><span class="pre">--gui</span></tt>).</p>
|
||||
<div class="section" id="building-the-devel-branch">
|
||||
<h4><a class="toc-backref" href="#id22">Building the Devel Branch</a></h4>
|
||||
<h4><a class="toc-backref" href="#id23">Building the Devel Branch</a></h4>
|
||||
<p>In the <span class="sc">Coriolis</span> <span class="cb">git</span> repository, two branches are present:</p>
|
||||
<ul>
|
||||
<li><p class="first">The <span class="cb">master</span> branch, which contains the latest stable version. This is the
|
||||
|
@ -418,7 +436,7 @@ dummy@lepka:work$ gdb python core.XXXX
|
|||
<p><span class="raw-html"><hr></span></p>
|
||||
</div>
|
||||
<div class="section" id="additionnal-requirement-under-macos">
|
||||
<h4><a class="toc-backref" href="#id23">Additionnal Requirement under <span class="sc">MacOS</span></a></h4>
|
||||
<h4><a class="toc-backref" href="#id24">Additionnal Requirement under <span class="sc">MacOS</span></a></h4>
|
||||
<p><span class="sc">Coriolis</span> make uses of the <span class="cb">boost::python</span> module, but the <span class="sc">MacPorts</span> <span class="cb">boost</span>
|
||||
seems unable to work with the <span class="sc">Python</span> bundled with <span class="sc">MacOS</span>. So you have to install
|
||||
both of them from <span class="sc">MacPorts</span>:</p>
|
||||
|
@ -433,7 +451,7 @@ the system.</p>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="packaging-coriolis">
|
||||
<h3><a class="toc-backref" href="#id24">Packaging Coriolis</a></h3>
|
||||
<h3><a class="toc-backref" href="#id25">Packaging Coriolis</a></h3>
|
||||
<p>Packager should not uses <span class="cb">ccb</span>, instead <tt class="docutils literal">bootstrap/Makefile.package</tt> is provided
|
||||
to emulate a top-level <tt class="docutils literal">autotool</tt> makefile. Just copy it in the root of the
|
||||
<span class="sc">Coriolis</span> git repository (<tt class="docutils literal"><span class="pre">~/corriolis-2.x/src/coriolis/</span></tt>) and build.</p>
|
||||
|
@ -444,7 +462,7 @@ to emulate a top-level <tt class="docutils literal">autotool</tt> makefile. Just
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="hooking-up-into-alliance">
|
||||
<h3><a class="toc-backref" href="#id25">Hooking up into <span class="sc">Alliance</span></a></h3>
|
||||
<h3><a class="toc-backref" href="#id26">Hooking up into <span class="sc">Alliance</span></a></h3>
|
||||
<p><span class="sc">Coriolis</span> relies on <span class="sc">Alliance</span> for the cell libraries. So after installing or
|
||||
packaging, you must configure it so that it can found those libraries.</p>
|
||||
<p>This is done by editing the one variable <span class="cb">cellsTop</span> in the <span class="sc">Alliance</span> helper
|
||||
|
@ -453,7 +471,7 @@ cells libraries. In a typical installation, this is generally
|
|||
<span class="cb">/usr/share/alliance/cells</span>.</p>
|
||||
</div>
|
||||
<div class="section" id="setting-up-the-environment-coriolisenv-py">
|
||||
<h3><a class="toc-backref" href="#id26">Setting up the Environment (coriolisEnv.py)</a></h3>
|
||||
<h3><a class="toc-backref" href="#id27">Setting up the Environment (coriolisEnv.py)</a></h3>
|
||||
<p>To simplify the tedious task of configuring your environment, a helper is provided
|
||||
in the <tt class="docutils literal">bootstrap</tt> source directory (also installed in the directory
|
||||
<tt class="docutils literal"><span class="pre">.../install/etc/coriolis2/</span></tt>) :</p>
|
||||
|
@ -479,7 +497,7 @@ alias c2r='eval "`~/coriolis-2.x/src/coriolis/bootstrap/coriolisEnv.py`&quo
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="documentation">
|
||||
<h2><a class="toc-backref" href="#id27">Documentation</a></h2>
|
||||
<h2><a class="toc-backref" href="#id28">Documentation</a></h2>
|
||||
<p>The general index of the documentation for the various parts of Coriolis
|
||||
are avalaibles here <a class="reference external" href="file:///usr/share/doc/coriolis2/index.html">Coriolis Tools Documentation</a>.</p>
|
||||
<div class="note">
|
||||
|
@ -491,7 +509,7 @@ mimic <em>as closely as possible</em> the C++ interface, so the documentation
|
|||
applies to both languages with only minor syntactic changes.</p>
|
||||
</div>
|
||||
<div class="section" id="general-software-architecture">
|
||||
<h3><a class="toc-backref" href="#id28">General Software Architecture</a></h3>
|
||||
<h3><a class="toc-backref" href="#id29">General Software Architecture</a></h3>
|
||||
<p><span class="sc">Coriolis</span> has been build with respect of the classical paradigm that the
|
||||
computational instensive parts have been written in C++, and almost
|
||||
everything else in <span class="sc">Python</span>. To build the <span class="sc">Python</span> interface we used
|
||||
|
@ -506,7 +524,7 @@ or C++/<span class="sc">Python</span> secure bi-directional object deletion.</li
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="coriolis-configuration-initialisation">
|
||||
<h2><a class="toc-backref" href="#id29">Coriolis Configuration & Initialisation</a></h2>
|
||||
<h2><a class="toc-backref" href="#id30">Coriolis Configuration & Initialisation</a></h2>
|
||||
<p>All configuration & initialization files are Python scripts, despite their
|
||||
<span class="cb">.conf</span> extention. From a syntactic point of view, there is no difference
|
||||
between the system-wide configuration files and the user's configuration,
|
||||
|
@ -518,7 +536,7 @@ they may use the same Python helpers.
|
|||
<li>Loading the complete configuration for the given technology.</li>
|
||||
</ol>
|
||||
<div class="section" id="first-stage-symbolic-technology-selection">
|
||||
<h3><a class="toc-backref" href="#id30">First Stage: Symbolic Technology Selection</a></h3>
|
||||
<h3><a class="toc-backref" href="#id31">First Stage: Symbolic Technology Selection</a></h3>
|
||||
<p><span class="raw-html"><p class="empty"></p></span>
|
||||
The initialization process is done by executing, in order, the following
|
||||
file(s):</p>
|
||||
|
@ -559,7 +577,7 @@ realTechno = 'hcmos9'
|
|||
</pre>
|
||||
</div>
|
||||
<div class="section" id="second-stage-technology-configuration-loading">
|
||||
<h3><a class="toc-backref" href="#id31">Second Stage: Technology Configuration Loading</a></h3>
|
||||
<h3><a class="toc-backref" href="#id32">Second Stage: Technology Configuration Loading</a></h3>
|
||||
<p><span class="raw-html"><p class="empty"></p></span>
|
||||
The <span class="cb">TECHNO</span> variable is set by the first stage and it's the name of the
|
||||
symbolic technology. A directory of that name, with all the configuration files,
|
||||
|
@ -604,7 +622,7 @@ which <em>must</em> contain a <span class="cb">coriolisConfigure()</span> functi
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="configuration-helpers">
|
||||
<h3><a class="toc-backref" href="#id32">Configuration Helpers</a></h3>
|
||||
<h3><a class="toc-backref" href="#id33">Configuration Helpers</a></h3>
|
||||
<p>To ease the writing of configuration files, a set of small helpers
|
||||
is available. They allow to setup the configuration parameters through
|
||||
simple assembly of tuples. The helpers are installed under the directory:</p>
|
||||
|
@ -614,7 +632,7 @@ simple assembly of tuples. The helpers are installed under the directory:</p>
|
|||
<p>Where <span class="cb"><install>/</span> is the root of the installation.</p>
|
||||
<p><span class="raw-html"><hr></span></p>
|
||||
<div class="section" id="id1">
|
||||
<span id="alliance-helper"></span><h4><a class="toc-backref" href="#id33"><span class="sc">Alliance</span> Helper</a></h4>
|
||||
<span id="alliance-helper"></span><h4><a class="toc-backref" href="#id34"><span class="sc">Alliance</span> Helper</a></h4>
|
||||
<p>The configuration file must provide a <span class="cb">allianceConfig</span> tuple of
|
||||
the form:</p>
|
||||
<pre class="literal-block">
|
||||
|
@ -707,7 +725,7 @@ allianceConfig = \
|
|||
</pre>
|
||||
</div>
|
||||
<div class="section" id="tools-configuration-helpers">
|
||||
<h4><a class="toc-backref" href="#id34">Tools Configuration Helpers</a></h4>
|
||||
<h4><a class="toc-backref" href="#id35">Tools Configuration Helpers</a></h4>
|
||||
<p>All the tools uses the same helper to load their configuration (a.k.a.
|
||||
<em>Configuration Helper</em>). Currently the following configuration system-wide
|
||||
configuration files are defined:</p>
|
||||
|
@ -783,7 +801,7 @@ by the tools. The list of parameters is detailed in each tool section.</li>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="hacking-the-configuration-files">
|
||||
<h3><a class="toc-backref" href="#id35">Hacking the Configuration Files</a></h3>
|
||||
<h3><a class="toc-backref" href="#id36">Hacking the Configuration Files</a></h3>
|
||||
<p>Asides from the symbols that gets used by the configuration helpers like
|
||||
<span class="cb">allianceConfig</span> or <span class="cb">parametersTable</span>, you can put pretty much anything
|
||||
in <span class="cb"><CWD>/.coriolis2/settings.py</span> (that is, written in <span class="sc">Python</span>).</p>
|
||||
|
@ -818,7 +836,7 @@ for fileName in os.listdir('.'):
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="cgt-the-graphical-interface">
|
||||
<h2><a class="toc-backref" href="#id36">CGT - The Graphical Interface</a></h2>
|
||||
<h2><a class="toc-backref" href="#id37">CGT - The Graphical Interface</a></h2>
|
||||
<p>The <span class="sc">Coriolis</span> graphical interface is split up into two windows.</p>
|
||||
<ul class="simple">
|
||||
<li>The <strong>Viewer</strong>, with the following features:<ul>
|
||||
|
@ -848,15 +866,15 @@ They are closely related to Configuration & Initialisation.</li>
|
|||
<p><span class="raw-html"><center><img src="./images/Controller-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id2">
|
||||
<span id="viewer-tools"></span><h2><a class="toc-backref" href="#id37">Viewer & Tools</a></h2>
|
||||
<span id="viewer-tools"></span><h2><a class="toc-backref" href="#id38">Viewer & Tools</a></h2>
|
||||
<div class="section" id="stratus-netlist-capture">
|
||||
<h3><a class="toc-backref" href="#id38"><span class="sc">Stratus</span> Netlist Capture</a></h3>
|
||||
<h3><a class="toc-backref" href="#id39"><span class="sc">Stratus</span> Netlist Capture</a></h3>
|
||||
<p><span class="sc">Stratus</span> is the replacement for <span class="sc">GenLib</span> procedural netlist capture language.
|
||||
It is designed as a set of <span class="sc">Python</span> classes, and comes with it's own documentation
|
||||
(<a class="reference external" href="file:///usr/share/doc/coriolis2/en/html/stratus/index.html">Stratus Documentation</a>)</p>
|
||||
</div>
|
||||
<div class="section" id="the-hurricane-data-base">
|
||||
<h3><a class="toc-backref" href="#id39">The <span class="sc">Hurricane</span> Data-Base</a></h3>
|
||||
<h3><a class="toc-backref" href="#id40">The <span class="sc">Hurricane</span> Data-Base</a></h3>
|
||||
<p>The <span class="sc">Alliance</span> flow is based on the <span class="sc">mbk</span> data-base, which has one data-structure
|
||||
for each view. That is, <span class="cb">Lofig</span> for the <em>logical</em> view and <span class="cb">Phfig</span> for the <em>physical</em>
|
||||
view. The place and route tools were responsible for maintaining (or not) the
|
||||
|
@ -884,14 +902,14 @@ state.</li>
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="synthetizing-and-loading-a-design">
|
||||
<h3><a class="toc-backref" href="#id40">Synthetizing and loading a design</a></h3>
|
||||
<h3><a class="toc-backref" href="#id41">Synthetizing and loading a design</a></h3>
|
||||
<p><span class="sc">Coriolis</span> supports several file formats. It can load all file format
|
||||
from the <span class="sc">Alliance</span> toolchain (.ap for layout, behavioural and structural vhdl .vbe and .vst),
|
||||
BLIF netlist format as well as benchmark formats from the ISPD contests.</p>
|
||||
<p>It can be compiled with LEF/DEF support, although it requires acceptance of the SI2 license
|
||||
and may not be compiled in your version of the software.</p>
|
||||
<div class="section" id="synthesis-under-yosys">
|
||||
<h4><a class="toc-backref" href="#id41">Synthesis under Yosys</a></h4>
|
||||
<h4><a class="toc-backref" href="#id42">Synthesis under Yosys</a></h4>
|
||||
<p>You can create a BLIF file from the <span class="sc">Yosys</span> synthetizer, which can be imported under Coriolis.
|
||||
Most libraries are specified as a .lib liberty file and a .lef LEF file.
|
||||
<span class="sc">Yosys</span> opens most .lib files with minor modifications, but LEF support in Coriolis relies on SI2.
|
||||
|
@ -901,13 +919,13 @@ If Coriolis hasn't been compiled against it, the library is given in <span class
|
|||
with <span class="sc">Yosys</span> and import it (as Blif without the extension) under Coriolis to perform place&route.</p>
|
||||
</div>
|
||||
<div class="section" id="synthesis-under-alliance">
|
||||
<h4><a class="toc-backref" href="#id42">Synthesis under Alliance</a></h4>
|
||||
<h4><a class="toc-backref" href="#id43">Synthesis under Alliance</a></h4>
|
||||
<p><span class="sc">Alliance</span> is an older toolchain but has been extensively used for years. Coriolis can import
|
||||
and write Alliance designs and libraries directly.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="etesian-placer">
|
||||
<h3><a class="toc-backref" href="#id43">Etesian -- Placer</a></h3>
|
||||
<h3><a class="toc-backref" href="#id44">Etesian -- Placer</a></h3>
|
||||
<p>The <span class="sc">Etesian</span> placer is a state of the art (as of 2015) analytical placer. It is
|
||||
within <tt class="docutils literal">5%</tt> of other placers' solutions, but is normally a bit worse than ePlace.
|
||||
This <span class="sc">Coriolis</span> tool is actually an encapsulation of <span class="sc">Coloquinte</span> which <em>is</em> the placer.</p>
|
||||
|
@ -947,7 +965,7 @@ Timing and routability analysis are not included either, and the returned placem
|
|||
may be unroutable.</p>
|
||||
<p><span class="raw-html"><hr></span></p>
|
||||
<div class="section" id="etesian-configuration-parameters">
|
||||
<h4><a class="toc-backref" href="#id44">Etesian Configuration Parameters</a></h4>
|
||||
<h4><a class="toc-backref" href="#id45">Etesian Configuration Parameters</a></h4>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="43%" />
|
||||
|
@ -1018,7 +1036,7 @@ More refreshing slows the placer.</p>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="knik-global-router">
|
||||
<h3><a class="toc-backref" href="#id45">Knik -- Global Router</a></h3>
|
||||
<h3><a class="toc-backref" href="#id46">Knik -- Global Router</a></h3>
|
||||
<p>The quality of <span class="sc">Knik</span> global routing solutions are equivalent to those of <a class="reference external" href="http://vlsicad.eecs.umich.edu/BK/FGR/">FGR</a> 1.0.
|
||||
For an in-depth description of <span class="sc">Knik</span> algorithms, you may download the thesis of
|
||||
D. <span class="sc">Dupuis</span> avalaible from here~: <a class="reference external" href="http://www-soc.lip6.fr/en/users/damiendupuis/PhD/">Knik Thesis</a>.</p>
|
||||
|
@ -1033,7 +1051,7 @@ a global routing <em>solution</em> can be saved to disk and reloaded for later u
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="kite-detailed-router">
|
||||
<h3><a class="toc-backref" href="#id46">Kite -- Detailed Router</a></h3>
|
||||
<h3><a class="toc-backref" href="#id47">Kite -- Detailed Router</a></h3>
|
||||
<p><span class="sc">Kite</span> no longer suffers from the limitations of <span class="sc">Nero</span>. It can route big designs
|
||||
as its runtime and memory footprint is almost linear (with respect to the number
|
||||
of gates). It has successfully routed design of more than <cite>150K</cite> gates.
|
||||
|
@ -1084,7 +1102,7 @@ that step.</p>
|
|||
<span class="sc">Kite</span> (on GCells) until the routing is finalized. Special layers appears
|
||||
to that effect in the <a class="reference internal" href="#the-layers-go-tab">The Layers&Go Tab</a>.</p>
|
||||
<div class="section" id="kite-configuration-parameters">
|
||||
<h4><a class="toc-backref" href="#id47">Kite Configuration Parameters</a></h4>
|
||||
<h4><a class="toc-backref" href="#id48">Kite Configuration Parameters</a></h4>
|
||||
<p>As <span class="sc">Knik</span> is only called through <span class="sc">Kite</span>, it's parameters also have
|
||||
the <span class="cb">kite.</span> prefix.</p>
|
||||
<p>The <span class="sc">Katabatic</span> parameters control the layer assignment step.</p>
|
||||
|
@ -1208,7 +1226,7 @@ topological modification</td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="executing-python-scripts-in-cgt">
|
||||
<span id="python-scripts-in-cgt"></span><h3><a class="toc-backref" href="#id48">Executing Python Scripts in Cgt</a></h3>
|
||||
<span id="python-scripts-in-cgt"></span><h3><a class="toc-backref" href="#id49">Executing Python Scripts in Cgt</a></h3>
|
||||
<p>Python/Stratus scripts can be executed either in text or graphical mode.</p>
|
||||
<div class="note">
|
||||
<p class="first admonition-title">Note</p>
|
||||
|
@ -1228,7 +1246,7 @@ initializations and <em>before</em> any other argument is processed.</p>
|
|||
<p>For more explanation on Python scripts see <a class="reference internal" href="#python-interface-to-coriolis">Python Interface to Coriolis</a>.</p>
|
||||
</div>
|
||||
<div class="section" id="printing-snapshots">
|
||||
<h3><a class="toc-backref" href="#id49">Printing & Snapshots</a></h3>
|
||||
<h3><a class="toc-backref" href="#id50">Printing & Snapshots</a></h3>
|
||||
<p>Printing or saving into a <span class="sc">pdf</span> is fairly simple, just uses the <strong>File -> Print</strong>
|
||||
menu or the <span class="fboxtt">CTRL+P</span> shortcut to open the dialog box.</p>
|
||||
<p>The print functionality uses exactly the same rendering mechanism as for the
|
||||
|
@ -1271,7 +1289,7 @@ or similar.</p>
|
|||
Saving into an image is subject to the same remarks as for <span class="sc">pdf</span>.</p>
|
||||
</div>
|
||||
<div class="section" id="memento-of-shortcuts-in-graphic-mode">
|
||||
<h3><a class="toc-backref" href="#id50">Memento of Shortcuts in Graphic Mode</a></h3>
|
||||
<h3><a class="toc-backref" href="#id51">Memento of Shortcuts in Graphic Mode</a></h3>
|
||||
<p>The main application binary is <span class="cb">cgt</span>.</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
|
@ -1408,7 +1426,7 @@ in which this model is instanciated).</td>
|
|||
</table>
|
||||
</div>
|
||||
<div class="section" id="cgt-command-line-options">
|
||||
<h3><a class="toc-backref" href="#id51">Cgt Command Line Options</a></h3>
|
||||
<h3><a class="toc-backref" href="#id52">Cgt Command Line Options</a></h3>
|
||||
<p>Appart from the obvious <tt class="docutils literal"><span class="pre">--text</span></tt> options, all can be used for text and graphical mode.</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
|
@ -1493,7 +1511,7 @@ routed design :</p>
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="miscellaneous-settings">
|
||||
<h3><a class="toc-backref" href="#id52">Miscellaneous Settings</a></h3>
|
||||
<h3><a class="toc-backref" href="#id53">Miscellaneous Settings</a></h3>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="46%" />
|
||||
|
@ -1566,7 +1584,7 @@ To generate one set this flag to <span class="cb">True</span></td>
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="id3">
|
||||
<span id="the-controller"></span><h2><a class="toc-backref" href="#id53">The Controller</a></h2>
|
||||
<span id="the-controller"></span><h2><a class="toc-backref" href="#id54">The Controller</a></h2>
|
||||
<p>The <em>Controller</em> window is composed of seven tabs:</p>
|
||||
<ol class="arabic simple">
|
||||
<li><a class="reference internal" href="#the-look-tab">The Look Tab</a> to select the display style.</li>
|
||||
|
@ -1581,14 +1599,14 @@ the current selection.</li>
|
|||
<li><a class="reference internal" href="#the-settings-tab">The Settings Tab</a> access all the tool's configuration settings.</li>
|
||||
</ol>
|
||||
<div class="section" id="id4">
|
||||
<span id="the-look-tab"></span><h3><a class="toc-backref" href="#id54">The Look Tab</a></h3>
|
||||
<span id="the-look-tab"></span><h3><a class="toc-backref" href="#id55">The Look Tab</a></h3>
|
||||
<p>You can select how the layout will be displayed. There is a special one
|
||||
<tt class="docutils literal">Printer.Coriolis</tt> specifically designed for <a class="reference internal" href="#printing-snapshots">Printing & Snapshots</a>.
|
||||
You should select it prior to calling the print or snapshot dialog boxes.</p>
|
||||
<p><span class="raw-html"><center><img src="./images/Controller-Look-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id5">
|
||||
<span id="the-filter-tab"></span><h3><a class="toc-backref" href="#id55">The Filter Tab</a></h3>
|
||||
<span id="the-filter-tab"></span><h3><a class="toc-backref" href="#id56">The Filter Tab</a></h3>
|
||||
<p>The filter tab let you select what hierarchical levels of your design will be
|
||||
displayed. Hierarchy level are numbered top-down: the level 0 correspond to
|
||||
the top-level cell, the level one to the instances of the top-level Cell and
|
||||
|
@ -1611,7 +1629,7 @@ They have been made <em>very</em> visibles as big violet lines...</p>
|
|||
<p><span class="raw-html"><center><img src="./images/Controller-Filter-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id6">
|
||||
<span id="the-layers-go-tab"></span><h3><a class="toc-backref" href="#id56">The Layers&Go Tab</a></h3>
|
||||
<span id="the-layers-go-tab"></span><h3><a class="toc-backref" href="#id57">The Layers&Go Tab</a></h3>
|
||||
<p>Control the individual display of all <em>layers</em> and <em>Gos</em>.</p>
|
||||
<ul class="simple">
|
||||
<li><em>Layers</em> correspond to a true physical layer. From a <span class="sc">Hurricane</span> point of
|
||||
|
@ -1629,7 +1647,7 @@ to easily locate congested areas.</li>
|
|||
<p><span class="raw-html"><center><img src="./images/Controller-LayersGos-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id7">
|
||||
<span id="the-netlist-tab"></span><h3><a class="toc-backref" href="#id57">The Netlist Tab</a></h3>
|
||||
<span id="the-netlist-tab"></span><h3><a class="toc-backref" href="#id58">The Netlist Tab</a></h3>
|
||||
<p>The <em>Netlist</em> tab shows the list of nets... By default the tab is not
|
||||
<em>synched</em> with the displayed Cell. To see the nets you must check the
|
||||
<strong>Sync Netlist</strong> checkbox. You can narrow the set of displayed nets by
|
||||
|
@ -1642,7 +1660,7 @@ is highlited in the <em>Viewer</em>.</p>
|
|||
<span class="raw-html"><center><img src="./images/Viewer-Netlist-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id8">
|
||||
<span id="the-selection-tab"></span><h3><a class="toc-backref" href="#id58">The Selection Tab</a></h3>
|
||||
<span id="the-selection-tab"></span><h3><a class="toc-backref" href="#id59">The Selection Tab</a></h3>
|
||||
<p>The <em>Selection</em> tab list all the components currently selecteds. They
|
||||
can be filtered thanks to the filter pattern.</p>
|
||||
<p>Used in conjunction with the <em>Netlist</em> <strong>Sync Selection</strong> you will all see
|
||||
|
@ -1655,7 +1673,7 @@ the <tt class="docutils literal">t</tt> key...</p>
|
|||
<p><span class="raw-html"><center><img src="./images/Controller-Selection-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id9">
|
||||
<span id="the-inspector-tab"></span><h3><a class="toc-backref" href="#id59">The Inspector Tab</a></h3>
|
||||
<span id="the-inspector-tab"></span><h3><a class="toc-backref" href="#id60">The Inspector Tab</a></h3>
|
||||
<p>This tab is very useful, but mostly for <span class="sc">Coriolis</span> developpers. It allows
|
||||
to browse through the live DataBase. The <em>Inspector</em> provide three entry points:</p>
|
||||
<ul class="simple">
|
||||
|
@ -1681,13 +1699,13 @@ is deleted, you will crash the application...</p>
|
|||
<span class="raw-html"><center><img src="./images/Controller-Inspector-3.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
<div class="section" id="id10">
|
||||
<span id="the-settings-tab"></span><h3><a class="toc-backref" href="#id60">The Settings Tab</a></h3>
|
||||
<span id="the-settings-tab"></span><h3><a class="toc-backref" href="#id61">The Settings Tab</a></h3>
|
||||
<p>Here comes the description of the <em>Settings</em> tab.</p>
|
||||
<p><span class="raw-html"><center><img src="./images/Controller-Settings-1.png" alt="Controller Basic Snapshot"></center></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="python-interface-for-hurricane-coriolis">
|
||||
<span id="python-interface-to-coriolis"></span><h2><a class="toc-backref" href="#id61">Python Interface for <span class="sc">Hurricane</span> / <span class="sc">Coriolis</span></a></h2>
|
||||
<span id="python-interface-to-coriolis"></span><h2><a class="toc-backref" href="#id62">Python Interface for <span class="sc">Hurricane</span> / <span class="sc">Coriolis</span></a></h2>
|
||||
<p>The (almost) complete interface of <span class="sc">Hurricane</span> is exported as a <span class="sc">Python</span> module
|
||||
and some part of the other components of <span class="sc">Coriolis</span> (each one in a separate
|
||||
module). The interface has been made to mirror as closely as possible the
|
||||
|
@ -1766,13 +1784,13 @@ lauched through <span class="cb">cgt</span>.</td>
|
|||
</ol>
|
||||
</div>
|
||||
<div class="section" id="plugins">
|
||||
<h2><a class="toc-backref" href="#id62">Plugins</a></h2>
|
||||
<h2><a class="toc-backref" href="#id63">Plugins</a></h2>
|
||||
<p>Plugins are <span class="sc">Python</span> scripts specially crafted to integrate with <span class="cb">cgt</span>.
|
||||
Their entry point is a <span class="cb">ScriptMain()</span> method as described in
|
||||
<a class="reference internal" href="#python-interface-to-coriolis">Python Interface to Coriolis</a>. They can be called by user scripts
|
||||
through this method.</p>
|
||||
<div class="section" id="chip-placement">
|
||||
<h3><a class="toc-backref" href="#id63">Chip Placement</a></h3>
|
||||
<h3><a class="toc-backref" href="#id64">Chip Placement</a></h3>
|
||||
<p>Automatically perform the placement of a complete chip. This plugin, as well
|
||||
as the other P&R tools expect a specific top-level hierarchy for the design.
|
||||
The top-level hierarchy must contains the instances of all the I/O pads and
|
||||
|
@ -1947,7 +1965,7 @@ only four rails (2* <tt class="docutils literal">power</tt>, 2* <tt class="docut
|
|||
</div>
|
||||
</div>
|
||||
<div class="section" id="clock-tree">
|
||||
<h3><a class="toc-backref" href="#id64">Clock Tree</a></h3>
|
||||
<h3><a class="toc-backref" href="#id65">Clock Tree</a></h3>
|
||||
<p>Insert a clock tree into a block. The clock tree uses the H strategy.
|
||||
The clock net is splitted into sub-nets, one for each branch of the
|
||||
tree.</p>
|
||||
|
@ -2039,14 +2057,14 @@ into retirement very soon</td>
|
|||
</table>
|
||||
</div>
|
||||
<div class="section" id="recursive-save-rsave">
|
||||
<h3><a class="toc-backref" href="#id65">Recursive-Save (RSave)</a></h3>
|
||||
<h3><a class="toc-backref" href="#id66">Recursive-Save (RSave)</a></h3>
|
||||
<p>Perform a recursive top down save of all the models from the top cell
|
||||
loaded in <span class="cb">cgt</span>. Force a write of any non-terminal model. This plugin is used
|
||||
by the clock tree plugin after the netlist clock sub-nets creation.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="a-simple-example-am2901">
|
||||
<h2><a class="toc-backref" href="#id66">A Simple Example: AM2901</a></h2>
|
||||
<h2><a class="toc-backref" href="#id67">A Simple Example: AM2901</a></h2>
|
||||
<p>To illustrate the capabilities of <span class="sc">Coriolis</span> tools and <span class="sc">Python</span> scripting, a small
|
||||
example, derived from the <span class="sc">Alliance</span> <span class="cb">AM2901</span> is supplied.</p>
|
||||
<p>This example contains only the synthetized netlists and the <span class="cb">doChip.py</span> script
|
||||
|
|
Binary file not shown.
|
@ -129,6 +129,7 @@
|
|||
.. _hMETIS: http://glaros.dtc.umn.edu/gkhome/views/metis
|
||||
.. _Knik Thesis: http://www-soc.lip6.fr/en/users/damiendupuis/PhD/
|
||||
.. _Coin Or Home: http://www.coin-or.org/index.html
|
||||
.. _RapidJSON: http://miloyip.github.io/rapidjson/
|
||||
|
||||
.. _coriolis2-1.0.2049-1.slsoc6.i686.rpm: http://asim.lip6.fr/pub/coriolis/2.0/coriolis2-1.0.2049-1.slsoc6.i686.rpm
|
||||
.. _coriolis2-1.0.2049-1.slsoc6.x86_64.rpm: http://asim.lip6.fr/pub/coriolis/2.0/coriolis2-1.0.2049-1.slsoc6.x86_64.rpm
|
||||
|
@ -317,8 +318,8 @@ Release v2.0.1
|
|||
achieve a speedup factor greater than 20...
|
||||
|
||||
|
||||
**Release v2.1**
|
||||
~~~~~~~~~~~~~~~~
|
||||
Release v2.1
|
||||
~~~~~~~~~~~~
|
||||
|
||||
#. Replace the old simulated annealing placer |Mauka| by the analytical placer
|
||||
|Etesian| and its legalization and detailed placement tools.
|
||||
|
@ -334,6 +335,13 @@ Release v2.0.1
|
|||
.. as possible.
|
||||
|
||||
|
||||
**Release v2.2**
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
#. Added JSON import/export of the whole Hurricane DataBase. Two save mode
|
||||
are supported: *Cell* mode (standalone) or *Blob* mode, which dump the
|
||||
whole design down and including the standard cells.
|
||||
|
||||
|
||||
|newpage|
|
||||
|
||||
|
@ -352,9 +360,11 @@ Main building prerequisites:
|
|||
|
||||
* cmake
|
||||
* C++11-capable compiler
|
||||
* RapidJSON_
|
||||
* python2.7
|
||||
* boost
|
||||
* libxml2
|
||||
* bzip2
|
||||
* yacc & lex
|
||||
* Qt 4 or Qt 5
|
||||
|
||||
|
@ -437,22 +447,29 @@ automatically created either by |ccb| or the build system.
|
|||
Building Coriolis
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
The first step is to create the source directory and pull the |git| repository: ::
|
||||
First step is to install the prerequisites. Currently, only RapidJSON_: ::
|
||||
|
||||
dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src/support
|
||||
dummy@lepka:~$ git clone http://github.com/miloyip/rapidjson
|
||||
|
||||
The second step is to create the source directory and pull the |git| repository: ::
|
||||
|
||||
dummy@lepka:~$ mkdir -p ~/coriolis-2.x/src
|
||||
dummy@lepka:~$ cd ~/coriolis-2.x/src
|
||||
dummy@lepka:~$ git clone https://www-soc.lip6.fr/git/coriolis.git
|
||||
|
||||
Second and final step, build & install: ::
|
||||
Third and final step, build & install: ::
|
||||
|
||||
dummy@lepka:src$ ./bootstrap/ccp.py --project=coriolis \
|
||||
dummy@lepka:src$ ./bootstrap/ccp.py --project=support \
|
||||
--project=coriolis \
|
||||
--make="-j4 install"
|
||||
dummy@lepka:src$ ./bootstrap/ccb.py --project=coriolis \
|
||||
dummy@lepka:src$ ./bootstrap/ccb.py --project=support \
|
||||
--project=coriolis \
|
||||
--doc --make="-j1 install"
|
||||
|
||||
We need two steps because the documentation do not support to be generated with
|
||||
a parallel build. So we compile & install in a first step in ``-j4`` (or whatever)
|
||||
then we generate the documentation in ``-j1``
|
||||
We need to separate to perform a separate installation of the documentation because it
|
||||
do not support to be generated with a parallel build. So we compile & install in a first
|
||||
stage in ``-j4`` (or whatever) then we generate the documentation in ``-j1``
|
||||
|
||||
Under |RHEL6| or clones, you must build using the |devtoolset2|: ::
|
||||
|
||||
|
|
|
@ -478,6 +478,7 @@ namespace Etesian {
|
|||
//masterCell->setAbutmentBox( topAb );
|
||||
//instance->setTransformation( Transformation() ); // (0,0,ID).
|
||||
//instance->setPlacementStatus( Instance::PlacementStatus::PLACED );
|
||||
occurrence.makeInvalid();
|
||||
instance->slaveAbutmentBox();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
setup_qt()
|
||||
|
||||
find_package(LibXml2 REQUIRED)
|
||||
find_package(BZip2 REQUIRED)
|
||||
find_package(BISON REQUIRED)
|
||||
find_package(FLEX REQUIRED)
|
||||
find_package(PythonLibs REQUIRED)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
/*! \class Initializer
|
||||
* \brief Register a static initialization function.
|
||||
*
|
||||
* \section secInitializerMechanism Initializer Mechanism
|
||||
*
|
||||
* In C++, there is currently no way to guarantee the order into
|
||||
* which the static initialization (variables) in various modules
|
||||
* will be done.
|
||||
*
|
||||
* The Initializer template class provide a way to perform a static
|
||||
* initialization across multiple modules in an ordered fashion,
|
||||
* thus solving potential dependency problems between initialisation.
|
||||
*/
|
||||
|
||||
//! \function Initializer::Initializer ( unsigned int order );
|
||||
//! Register a static initializer for the template type \c T.
|
||||
//! Initializer is a object that must be kept in a \c static
|
||||
//! variable in a compilation unit (i.e. a \c .cpp file).
|
||||
//!
|
||||
//! The template type \c T (a class) must provide a static function
|
||||
//! named \c initialize, with exactly the following signature:
|
||||
//! <code>void T::initialize()</code>.
|
||||
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
//! \addtogroup JsonSupport
|
||||
//! \{
|
||||
|
||||
|
||||
/*! \class JsonObject
|
||||
* \brief Support for JSON export.
|
||||
*
|
||||
*/
|
||||
|
||||
//! \function JsonObject::JsonObject ( unsigned long flags );
|
||||
//! \param flags Flags sets by derived classes.
|
||||
//!
|
||||
//! Base object to be used by all JSON parsers. Provides
|
||||
//! helpers functions. Store three separated lists of
|
||||
//! requirements/attributes needes to build the object.
|
||||
//! - \c stackeds : thoses are \b not attributes of the
|
||||
//! current object, but other objects that are expected
|
||||
//! to be already in the stack. They are needed to build the
|
||||
//! current object. Their key must start with a \c '.'
|
||||
//! character.
|
||||
//! - \c attributes : the simple attributes of the object.
|
||||
//! Their key must start with a \c '_'.
|
||||
//! - \c collections : any container, collection or whatever
|
||||
//! set of other objects part of the current object.
|
||||
//! Their key must start with a \c '+' character.
|
||||
//!
|
||||
//! For adding a requirement/attribute, see JsonObject::add().
|
||||
|
||||
//! \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.
|
||||
|
||||
//! \function string JsonObject::getStackName () const;
|
||||
//! \Return The key with which the DataBase object will be pushed on
|
||||
//! the parser stack.
|
||||
//!
|
||||
//! If the current object is associated to an attribute (that
|
||||
//! is, a key in JSON), then the \c name attribute of the JsonObject
|
||||
//! should have been set, and it will be returned here.
|
||||
//!
|
||||
//! If the \c name attribute has not been set (for example,
|
||||
//! because we are in an array). Then the typename (JsonObject::getTypeName()),
|
||||
//! prefixed by a \c '.' character will be returned.
|
||||
//!
|
||||
//! If the JsonObject is, for instance, a JsonBox (typename: \c "Box") :
|
||||
//! - If \c name is set to \c "_abutmentBox", the box will be stacked
|
||||
//! with that key.
|
||||
//! - If \c name is \b not set, then the key will be \c ".Box".
|
||||
|
||||
//! \function JsonObject* JsonObject::setFlags ( unsigned long mask );
|
||||
//! \param mask Flag(s) to be raised.
|
||||
//! \return The current object.
|
||||
|
||||
//! \function JsonObject* JsonObject::resetFlags ( unsigned long mask );
|
||||
//! \param mask Flag(s) to be lowered.
|
||||
//! \return The current object.
|
||||
|
||||
//! \function bool JsonObject::issetFlags ( unsigned long mask ) const;
|
||||
//! \param mask The combination of flags to be checked.
|
||||
//! \return \true if \b all the flags given in \c mask are sets.
|
||||
|
||||
//! \function bool JsonObject::check ( JsonStack& stack, string fname ) const;
|
||||
//! \param stack Where the objects already parsed are stored.
|
||||
//! \param fname The function name on behalf of which the check is
|
||||
//! performed.
|
||||
//! \return \true if the check is successful.
|
||||
//!
|
||||
//! Check that the \c stack actually contains all the objects (i.e. attributes)
|
||||
//! needed to build the current object. The list of \e attributes is built
|
||||
//! using the JsonObject::add() function. If an attribute is missing, a warning
|
||||
//! is issued, but the parser will try to continue.
|
||||
|
||||
//! \function bool JsonObject::has ( const string& key ) const;
|
||||
//! \param key The key name to search for.
|
||||
//! \return \true if the object possess such a key.
|
||||
|
||||
//! \function void JsonObject::add ( const string& key, type_index tid );
|
||||
//! \param key The requirement/attribute to add.
|
||||
//! \param tid The type index of the attribute.
|
||||
//!
|
||||
//! Adds a new requirement or attribute to the object. The first character
|
||||
//! of the key tells which kind it is:
|
||||
//! - \c '.' : a requirement (not part of the object) that must be present
|
||||
//! in the stack.
|
||||
//! - \c '_' : a simple attribute of the object.
|
||||
//! - \c '+' : belongs to a collection or container.
|
||||
//!
|
||||
//! A more detailed description could be found in JsonObject::JsonObject().
|
||||
|
||||
//! \function void JsonObject::remove ( const string& key );
|
||||
//! \param key The key of the requirement/attribute to remove.
|
||||
//!
|
||||
//! Removes an attribute from the current object.
|
||||
|
||||
//! \function T JsonObject::get ( JsonStack& stack, const string& key ) const;
|
||||
//! \param stack The object stack of the parser.
|
||||
//! \param key The key of the requested object.
|
||||
//! \return The first object associated with \c key, starting <em>from the top</em>
|
||||
//! of the stack.
|
||||
//!
|
||||
//! Retrieve requirements or attributes from the parser stack.
|
||||
//! - If no element with a corresponding key is found, an empty element
|
||||
//! of type \c T is returned (by calling the default \c T constructor).
|
||||
//! - 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 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.
|
||||
//!
|
||||
//! Copy the attributes from \c other into the current object. \b Only the
|
||||
//! \b attributes are copied. Neither the requirements, nor the collections.
|
||||
//! By default, the attributes are added to the existing one of the object,
|
||||
//! but if \c reset is \true, the original ones will be suppresseds.
|
||||
|
||||
//! \function void JsonObject::clear ();
|
||||
//! Removes all requirements/attributes/collections of the object.
|
||||
//! Also unbind it from any generated DataBase object.
|
||||
|
||||
//! \function string JsonObject::getName () const;
|
||||
//! \Return The name of the whole object as attribute.
|
||||
//!
|
||||
//! During the parsing of the JSON structure, excepted when in an array,
|
||||
//! an object is associated with a key. This is the string returned by
|
||||
//! this function. It is called \c getName() instead of \c getKey() to
|
||||
//! avoid confusing with the attributes keys.
|
||||
|
||||
//! \function void JsonObject::setName ( const string& name );
|
||||
//! \param name Set the key associated to this object.
|
||||
//!
|
||||
//! See JsonObject::getName() for the meaning of the name (key).
|
||||
|
||||
//! \function T& JsonObject::getObject () const;
|
||||
//! \Return The associated DataBase object.
|
||||
//!
|
||||
//! Once all the attributes have been gathered, the creation of the
|
||||
//! DataBase object is triggered by calling JsonObject::toData().
|
||||
//! We keep track of that DataBase object by storing it (or a pointer
|
||||
//! to it) in an \c boost::any field of the JsonObject.
|
||||
|
||||
//! \function void JsonObject::setObject ( T );
|
||||
//! \param T The DataBase object.
|
||||
//!
|
||||
//! Associate the constructed DataBase object \c T to the JSON
|
||||
//! object (for later access).
|
||||
|
||||
//! \function bool JsonObject::isBound () const;
|
||||
//! \Return \true if a DataBase object is associated to the JSON object
|
||||
//! (see JsonObject::setObject()).
|
||||
|
||||
//! \function JsonObject* JsonObject::clone ( unsigned long flags ) const;
|
||||
//! \Return a new \b empty object <em>of the same dynamic type</em>
|
||||
//! as the source one.
|
||||
//!
|
||||
//! This is not a true clone operation in the sense that the datas
|
||||
//! of the original object are not copied. The cloning is about the
|
||||
//! type, and is the result of a call to the \c new operator.
|
||||
//!
|
||||
//! \Important This method must be overloaded in each concrete derived class.
|
||||
|
||||
//! \function void JsonObject::toData ( JsonStack& stack );
|
||||
//! \param The parser object stack.
|
||||
//!
|
||||
//! \Important This method must be overloaded in each concrete derived class.
|
||||
//!
|
||||
//! Creates the DataBase object. The requirements and attributes
|
||||
//! must be on top of the stack, they are popped, the DataBase object
|
||||
//! is created from them and the result is then pushed back.
|
||||
|
||||
//! \function unsigned int JsonObject::presetId ( JsonStack& stack );
|
||||
//! \param The parser object stack.
|
||||
//! \Return the <em>next id</em> that has been set.
|
||||
//!
|
||||
//! \Remark This is a helper for JsonStack::toData().
|
||||
//!
|
||||
//! In blob mode, the DataBase must be restored <em>as is</em>,
|
||||
//! including the \c ids of all the Entities (see Entity).
|
||||
//! This function read from the stack the \c _id attribute
|
||||
//! 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 hobject the newly created DataBase object.
|
||||
//!
|
||||
//! \Remark This is a helper for JsonStack::toData().
|
||||
//!
|
||||
//! Pop the attributes from the stack. Push the newly created
|
||||
//! object and bind it to the JsonObject.
|
||||
|
||||
|
||||
//! \}
|
||||
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
/*! \defgroup JsonSupport JSON Support
|
||||
* \brief JSON Import/Export of the DataBase
|
||||
*
|
||||
* \section secJsonSupportIntro Introduction
|
||||
*
|
||||
* One key feature of the Hurricane DataBase is it's hierarchical
|
||||
* managment. But unfortunatly the simple approach of saving a design
|
||||
* Cell by Cell, hierarchical level by hierarchical level makes it
|
||||
* very difficult to save the trans-hierarchical informations (mainly
|
||||
* is the occurrences)
|
||||
*
|
||||
* One solution is to save the design and all it's levels, down and
|
||||
* including the standard cells. With all the levels saved, we then
|
||||
* can add the occurrences and all the attached trans-hierarchical
|
||||
* informations. We call that comprehensive saving of a design,
|
||||
* a <em>design blob</em>.
|
||||
*
|
||||
* Instead of creating one more ad-hoc format, we just dump the
|
||||
* DataBase objects in a mirror like way in JSON format.
|
||||
*
|
||||
* As it is a textual format, the generated files are larges.
|
||||
* So the files are compressed through \c gzip.
|
||||
*
|
||||
*
|
||||
* \section secJsonSemantic JSON Additional Semantic
|
||||
*
|
||||
* To ease the work of the parser, some semantic has been added
|
||||
* to the JSON objects representing a Hurricane DataBase.
|
||||
* -# The first key/value pair must have the key \c "@typename"
|
||||
* and give the kind of JsonObject associated. The value is
|
||||
* the string returned by \c JsonObject::getTypeName().
|
||||
* -# Attributes keys must start by a \c '_' character.
|
||||
* (yes, I know, the C++ convention has changed and it should
|
||||
* be put at the end).
|
||||
* -# Collections or containers must be put \e after all the
|
||||
* scalar attributes and their keys must start by a \c '+'
|
||||
* character.
|
||||
*
|
||||
\code{.json}
|
||||
{
|
||||
"@typename": "Cell",
|
||||
"_id": 3,
|
||||
"_library": "RootLibrary.AllianceFramework.sxlib",
|
||||
"_name": "o3_x2",
|
||||
"_abutmentBox": {
|
||||
"@typename": "Box",
|
||||
"_xMin": 0,
|
||||
"_yMin": 0,
|
||||
"_xMax": 72000,
|
||||
"_yMax": 120000
|
||||
},
|
||||
"+instanceMap": [],
|
||||
"+netMap": [
|
||||
],
|
||||
}
|
||||
|
||||
\endcode
|
||||
*
|
||||
* \section secJsonDriver JSON Driver Support
|
||||
*
|
||||
* The driver is implemented through overloads (template and
|
||||
* non-template) of the \c jsonWriter() function. For the
|
||||
* template overload to work, even for non-Hurricane classes,
|
||||
* it is defined outside the Hurricane namespace.
|
||||
*
|
||||
* For POD types, four overloads of \c jsonWriter() are defined:
|
||||
*
|
||||
\code
|
||||
void jsonWrite ( JsonWriter* w, const int* v );
|
||||
void jsonWrite ( JsonWriter* w, int v );
|
||||
void jsonWrite ( JsonWriter* w, const std::string& key, const int* value )
|
||||
void jsonWrite ( JsonWriter* w, const std::string& key, int value )
|
||||
\endcode
|
||||
*
|
||||
* The first two writes the object (here: \c int) "as is" while
|
||||
* the two later writes a pair key/object.
|
||||
*
|
||||
* For other class/object that needs to be writen in the JSON file,
|
||||
* they must provide a \c toJson() function. It doesn't even need
|
||||
* to be virtual. For Point:
|
||||
*
|
||||
\code
|
||||
void Point::toJson ( JsonWriter* w ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Point" );
|
||||
jsonWrite( w, "_x", getX() );
|
||||
jsonWrite( w, "_y", getY() );
|
||||
w->endObject();
|
||||
}
|
||||
\endcode
|
||||
*
|
||||
* This function allows three templates of \c jsonWrite() to be
|
||||
* used with an object of class Point:
|
||||
*
|
||||
\code
|
||||
template<typename C>
|
||||
void jsonWrite ( JsonWriter* w, const C* object );
|
||||
|
||||
template<typename C>
|
||||
void jsonWrite ( JsonWriter* w, const std::string& key, C* object );
|
||||
|
||||
template<typename C>
|
||||
void jsonWrite ( JsonWriter* w, const std::string& key, const C* object );
|
||||
\endcode
|
||||
*
|
||||
* Note that through those three overloads we only provides
|
||||
* support for pointers to object. The driving mechanism is
|
||||
* designed in such a way that passing arguments by value is
|
||||
* not supported for non-POD types. Trying to do so will
|
||||
* result in an unsupported message inside the generated
|
||||
* JSON file.
|
||||
*
|
||||
*
|
||||
* \subsection secJsonDriverDBo DBos Special Case
|
||||
*
|
||||
* For DBo objects, a complete parallel hierarchy of JsonObjects
|
||||
* mimicking the one of DBos has been implemented. The \c toJson()
|
||||
* function is implemented in the DBo base object, and the
|
||||
* derived classes must implement the following virtual functions:
|
||||
*
|
||||
\code
|
||||
class DBo {
|
||||
public:
|
||||
virtual void _toJson ( JsonWriter* ) const;
|
||||
virtual void _toJsonCollections ( JsonWriter* ) const;
|
||||
virtual void _toJsonSignature ( JsonWriter* ) const;
|
||||
void toJson ( JsonWriter* ) const;
|
||||
void toJsonSignature ( JsonWriter* ) const;
|
||||
\endcode
|
||||
*
|
||||
* The JSON driver functions is splitted in two parts:
|
||||
* - \c _toJson() must drive the scalar attributes.
|
||||
* - \c _toJsonCollections() must drive the various collections
|
||||
* or containers.
|
||||
* This is to ensure that all the scalars attributes are put
|
||||
* before the collections, event through inheritance.
|
||||
*
|
||||
* The additionnal \c toJsonSignature() method provide the
|
||||
* signature for an Entity which is used by an occurrence.
|
||||
* The signature of an occurrence is needed when we create
|
||||
* a JSON for a Cell only. In that case we cannot directly save
|
||||
* the transhierarchical informations, so we need a way to
|
||||
* characterize the deep Entity (which is not part of the
|
||||
* saved Cell). Most of the time, the signature is the scalar
|
||||
* attributes of the occurrenced object, it is far from foolproof,
|
||||
* but it will do for now.
|
||||
*
|
||||
*
|
||||
* \section secJsonParser JSON Parser Support
|
||||
*
|
||||
* To enable JSON parsing support for an object, say Point,
|
||||
* an associated \c JsonPoint class must be created. This
|
||||
* class must be derived (directly or not) from JsonObject.
|
||||
* It must implement one static functions and four methods,
|
||||
* as shown below.
|
||||
*
|
||||
\code
|
||||
class JsonPoint : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonPoint (unsigned long flags);
|
||||
virtual string getTypeName();
|
||||
virtual JsonPoint* clone (unsigned long flags);
|
||||
virtual void toData (JsonStack&);
|
||||
};
|
||||
\endcode
|
||||
*
|
||||
* The \c initialize() static function must be present in
|
||||
* concrete class only. It is used to register the Json
|
||||
* object into the parser during the static initialization
|
||||
* of the program.
|
||||
*
|
||||
\code
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Point.h"
|
||||
|
||||
Initializer<JsonPoint> jsonPointInit ( 0 );
|
||||
|
||||
void JsonPoint::initialize ()
|
||||
{ JsonTypes::registerType( new JsonPoint (JsonWriter::RegisterMode) ); }
|
||||
|
||||
\endcode
|
||||
*
|
||||
* The constructor has to declare requirements, attributes,
|
||||
* and collections needed to build the DataBase object.
|
||||
* Note the the requirements are not part of the objects
|
||||
* but only needed to build it.
|
||||
*
|
||||
\code{.cpp}
|
||||
JsonPoint::JsonPoint ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_x", typeid(int64_t) );
|
||||
add( "_y", typeid(int64_t) );
|
||||
}
|
||||
\endcode
|
||||
*
|
||||
* The \c getTypeName() virtual function must return the
|
||||
* typename used for the \c "@typename" key in the JSON
|
||||
* file. Most of the time it's the same name as the
|
||||
* object itself, but not always.
|
||||
*
|
||||
\code{.cpp}
|
||||
string JsonPoint::getTypeName () const
|
||||
{ return "Point"; }
|
||||
\endcode
|
||||
*
|
||||
* The \c clone() virtual function must return a brand new
|
||||
* Json object of the same type. The datas of the orignal
|
||||
* object \b must not be copied. The cloning is about the
|
||||
* class type, not the contents.
|
||||
*
|
||||
\code
|
||||
JsonPoint* JsonPoint::clone ( unsigned long flags ) const
|
||||
{ return new JsonPoint ( flags ); }
|
||||
\endcode
|
||||
*
|
||||
* The \c toData() virtual function actually gather the
|
||||
* attributes to recreate the DataBase object. It needs
|
||||
* the parser stack to pull the attributes and to push
|
||||
* the created object.
|
||||
*
|
||||
\code{.cpp}
|
||||
void JsonPoint::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonPoint::toData" );
|
||||
Point point ( DbU::fromDb(get<int64_t>(stack,"_x"))
|
||||
, DbU::fromDb(get<int64_t>(stack,"_y")) );
|
||||
update( stack, point );
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -13,7 +13,4 @@
|
|||
* relation between a name and a value.
|
||||
*/
|
||||
|
||||
// \}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -586,6 +586,11 @@ WARN_LOGFILE = doxygen.warn.log
|
|||
# with spaces.
|
||||
|
||||
INPUT = Generalities.dox \
|
||||
JsonSupport.dox \
|
||||
Initializer.dox \
|
||||
../../src/hurricane/hurricane/Initializer.h \
|
||||
JsonObject.dox \
|
||||
../../src/hurricane/hurricane/JsonReader.h \
|
||||
Hurricane.dox \
|
||||
../../src/hurricane/hurricane/Commons.h \
|
||||
Commons.dox \
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
// not, see <http://www.gnu.org/licenses/>.
|
||||
// ****************************************************************************************************
|
||||
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Box.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -365,6 +365,13 @@ void Box::toJson(JsonWriter* w) const
|
|||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
Initializer<JsonBox> jsonBoxInit ( 0 );
|
||||
|
||||
void JsonBox::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonBox (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonBox::JsonBox(unsigned long flags)
|
||||
// **********************************
|
||||
: JsonObject(flags)
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
|
||||
${CONFIGURATION_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${BZIP2_INCLUDE_DIR}
|
||||
)
|
||||
set ( includes hurricane/Mask.h
|
||||
hurricane/Flags.h
|
||||
hurricane/Initializer.h
|
||||
hurricane/DebugSession.h
|
||||
hurricane/Backtrace.h
|
||||
hurricane/FileReadGzStream.h
|
||||
hurricane/FileWriteGzStream.h
|
||||
hurricane/JsonWriter.h
|
||||
hurricane/JsonReader.h
|
||||
hurricane/Signature.h
|
||||
|
@ -98,9 +102,12 @@
|
|||
)
|
||||
set ( cpps Record.cpp
|
||||
Slot.cpp
|
||||
Initializer.cpp
|
||||
Commons.cpp
|
||||
Flags.cpp
|
||||
Backtrace.cpp
|
||||
FileReadGzStream.cpp
|
||||
FileWriteGzStream.cpp
|
||||
JsonWriter.cpp
|
||||
JsonReader.cpp
|
||||
Signature.cpp
|
||||
|
@ -176,7 +183,7 @@
|
|||
)
|
||||
|
||||
add_library ( hurricane ${cpps} )
|
||||
target_link_libraries ( hurricane ${Boost_LIBRARIES} )
|
||||
target_link_libraries ( hurricane ${Boost_LIBRARIES} ${BZIP2_LIBRARIES} )
|
||||
set_target_properties ( hurricane PROPERTIES VERSION 1.0 SOVERSION 1 )
|
||||
install ( TARGETS hurricane DESTINATION lib${LIB_SUFFIX} )
|
||||
install ( FILES ${includes} DESTINATION include/coriolis2/hurricane )
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/SharedName.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Instance.h"
|
||||
#include "hurricane/Net.h"
|
||||
|
@ -43,6 +43,10 @@
|
|||
namespace Hurricane {
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// UniquifyRelation implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
const Name Cell::UniquifyRelation::_name = "Cell::UniquifyRelation";
|
||||
|
||||
|
||||
|
@ -99,6 +103,18 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
string Cell::UniquifyRelation::getTrunkName ( Name name )
|
||||
{
|
||||
string trunk = getString(name);
|
||||
size_t suffix = trunk.rfind( "_u" );
|
||||
|
||||
if (suffix != string::npos)
|
||||
trunk = trunk.substr( 0, suffix );
|
||||
|
||||
return trunk;
|
||||
}
|
||||
|
||||
|
||||
Record* Cell::UniquifyRelation::_getRecord () const
|
||||
{
|
||||
Record* record = Relation::_getRecord();
|
||||
|
@ -109,6 +125,158 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
bool Cell::UniquifyRelation::hasJson () const
|
||||
{ return true; }
|
||||
|
||||
|
||||
void Cell::UniquifyRelation::toJson ( JsonWriter* w, const DBo* owner ) const
|
||||
{
|
||||
w->startObject();
|
||||
std::string tname = getString( staticGetName() );
|
||||
if (getMasterOwner() == owner) {
|
||||
jsonWrite( w, "@typename" , tname );
|
||||
jsonWrite( w, "_refcount" , getOwners().getSize() );
|
||||
jsonWrite( w, "_duplicates", _duplicates );
|
||||
} else {
|
||||
tname.insert( 0, "&" );
|
||||
jsonWrite( w, "@typename", tname );
|
||||
|
||||
Cell* masterOwner = dynamic_cast<Cell*>( getMasterOwner() );
|
||||
if (masterOwner) {
|
||||
jsonWrite( w, "_masterOwner", masterOwner->getHierarchicalName() );
|
||||
} else {
|
||||
cerr << Error( "UniquifyRelation::toJson(): Master owner is not a Cell (%s)."
|
||||
, getString(owner).c_str()
|
||||
) << endl;
|
||||
jsonWrite( w, "_masterOwner", "" );
|
||||
}
|
||||
}
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// UniquifyRelation::JsonProperty implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
|
||||
Initializer<Cell::UniquifyRelation::JsonProperty> jsonUniquifyRelationInit ( 10 );
|
||||
|
||||
|
||||
Cell::UniquifyRelation::JsonProperty::JsonProperty ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_refcount" , typeid(int64_t) );
|
||||
add( "_duplicates", typeid(int64_t) );
|
||||
}
|
||||
|
||||
|
||||
string Cell::UniquifyRelation::JsonProperty::getTypeName () const
|
||||
{ return getString(Cell::UniquifyRelation::staticGetName()); }
|
||||
|
||||
|
||||
void Cell::UniquifyRelation::JsonProperty::initialize ()
|
||||
{ JsonTypes::registerType( new Cell::UniquifyRelation::JsonProperty (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
Cell::UniquifyRelation::JsonProperty* Cell::UniquifyRelation::JsonProperty::clone ( unsigned long flags ) const
|
||||
{ return new Cell::UniquifyRelation::JsonProperty ( flags ); }
|
||||
|
||||
|
||||
void Cell::UniquifyRelation::JsonProperty::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "Cell::UniquifyRelation::JsonProperty::toData" );
|
||||
|
||||
DBo* dbo = stack.back_dbo();
|
||||
unsigned int refcount = get<int64_t>( stack, "_refcount" );
|
||||
unsigned int duplicates = get<int64_t>( stack, "_duplicates" );
|
||||
UniquifyRelation* relation = NULL;
|
||||
Cell* cell = dynamic_cast<Cell*>( dbo );
|
||||
|
||||
ltrace(51) << "topDBo:" << dbo << endl;
|
||||
|
||||
if (cell) {
|
||||
relation = UniquifyRelation::get( cell );
|
||||
if (not relation) {
|
||||
string tag = cell->getHierarchicalName()+"::"+getString(UniquifyRelation::staticGetName());
|
||||
relation = dynamic_cast<UniquifyRelation*>( SharedProperty::getOrphaned( tag ) );
|
||||
|
||||
if (not relation) {
|
||||
relation = Cell::UniquifyRelation::create( cell );
|
||||
SharedProperty::addOrphaned( tag, relation );
|
||||
}
|
||||
SharedProperty::refOrphaned( tag );
|
||||
SharedProperty::countOrphaned( tag, refcount );
|
||||
cell->put( relation );
|
||||
}
|
||||
relation->_setMasterOwner( cell );
|
||||
relation->_setDuplicates ( duplicates );
|
||||
}
|
||||
|
||||
update( stack, relation );
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// UniquifyRelation::JsonPropertyRef implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
|
||||
Initializer<Cell::UniquifyRelation::JsonPropertyRef> jsonUniquifyRelationRefInit ( 10 );
|
||||
|
||||
|
||||
Cell::UniquifyRelation::JsonPropertyRef::JsonPropertyRef ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_masterOwner", typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
string Cell::UniquifyRelation::JsonPropertyRef::getTypeName () const
|
||||
{ return string("&")+getString(Cell::UniquifyRelation::staticGetName()); }
|
||||
|
||||
|
||||
void Cell::UniquifyRelation::JsonPropertyRef::initialize ()
|
||||
{ JsonTypes::registerType( new Cell::UniquifyRelation::JsonPropertyRef (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
Cell::UniquifyRelation::JsonPropertyRef* Cell::UniquifyRelation::JsonPropertyRef::clone ( unsigned long flags ) const
|
||||
{ return new Cell::UniquifyRelation::JsonPropertyRef ( flags ); }
|
||||
|
||||
|
||||
void Cell::UniquifyRelation::JsonPropertyRef::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "Cell::UniquifyRelation::JsonPropertyRef::toData" );
|
||||
|
||||
DBo* dbo = stack.back_dbo();
|
||||
string masterName = get<string>( stack, "_masterOwner" );
|
||||
UniquifyRelation* relation = NULL;
|
||||
Cell* cell = dynamic_cast<Cell*>( dbo );
|
||||
string tag = masterName+"::"+getString(UniquifyRelation::staticGetName());
|
||||
|
||||
if (cell) {
|
||||
if (not relation) {
|
||||
relation = dynamic_cast<UniquifyRelation*>( SharedProperty::getOrphaned( tag ) );
|
||||
if (not relation) {
|
||||
relation = Cell::UniquifyRelation::create( cell );
|
||||
SharedProperty::addOrphaned( tag, relation );
|
||||
}
|
||||
}
|
||||
|
||||
if (relation) {
|
||||
cell->put( relation );
|
||||
SharedProperty::refOrphaned( tag );
|
||||
}
|
||||
}
|
||||
|
||||
update( stack, relation );
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Cell Slice related implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
void Cell::_insertSlice ( ExtensionSlice* slice )
|
||||
{
|
||||
ExtensionSliceMap::iterator islice = _extensionSlices.find ( slice->getName() );
|
||||
|
@ -177,14 +345,14 @@ Cell::Cell(Library* library, const Name& name)
|
|||
_observers(),
|
||||
_flags(Flags::Terminal)
|
||||
{
|
||||
if (!_library)
|
||||
throw Error("Can't create " + _TName("Cell") + " : null library");
|
||||
if (!_library)
|
||||
throw Error("Can't create " + _TName("Cell") + " : null library");
|
||||
|
||||
if (name.isEmpty())
|
||||
throw Error("Can't create " + _TName("Cell") + " : empty name");
|
||||
if (name.isEmpty())
|
||||
throw Error("Can't create " + _TName("Cell") + " : empty name");
|
||||
|
||||
if (_library->getCell(_name))
|
||||
throw Error("Can't create " + _TName("Cell") + " " + getString(_name) + " : already exists");
|
||||
if (_library->getCell(_name))
|
||||
throw Error("Can't create " + _TName("Cell") + " " + getString(_name) + " : already exists");
|
||||
}
|
||||
|
||||
Cell* Cell::create(Library* library, const Name& name)
|
||||
|
@ -895,9 +1063,11 @@ void Cell::_toJson(JsonWriter* writer) const
|
|||
void Cell::_toJsonCollections(JsonWriter* writer) const
|
||||
// *****************************************
|
||||
{
|
||||
writer->setFlags( JsonWriter::CellObject );
|
||||
jsonWrite( writer, "+instanceMap", getInstances() );
|
||||
jsonWrite( writer, "+netMap" , getNets() );
|
||||
Inherit::_toJsonCollections( writer );
|
||||
writer->resetFlags( JsonWriter::CellObject );
|
||||
}
|
||||
|
||||
// ****************************************************************************************************
|
||||
|
@ -1217,6 +1387,10 @@ void Cell::MarkerSet::_setNextElement(Marker* marker, Marker* nextMarker) const
|
|||
// JsonCell implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
|
||||
Initializer<JsonCell> jsonCellInitialize ( 10 );
|
||||
|
||||
|
||||
JsonCell::JsonCell(unsigned long flags)
|
||||
// ************************************
|
||||
: JsonEntity(flags)
|
||||
|
@ -1233,6 +1407,10 @@ string JsonCell::getTypeName() const
|
|||
// *********************************
|
||||
{ return "Cell"; }
|
||||
|
||||
void JsonCell::initialize()
|
||||
// *************************
|
||||
{ JsonTypes::registerType( new JsonCell (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonCell* JsonCell::clone(unsigned long flags) const
|
||||
// *************************************************
|
||||
{ return new JsonCell ( flags ); }
|
||||
|
@ -1243,8 +1421,9 @@ void JsonCell::toData(JsonStack& stack)
|
|||
check( stack, "JsonCell::toData" );
|
||||
presetId( stack );
|
||||
|
||||
Cell* cell = Cell::create( DataBase::getDB()->getLibrary( get<string>(stack,"_library") )
|
||||
, get<string>(stack,"_name") );
|
||||
Library* library = DataBase::getDB()->getLibrary( get<string>(stack,"_library")
|
||||
, DataBase::CreateLib|DataBase::WarnCreateLib );
|
||||
Cell* cell = Cell::create( library, get<string>(stack,"_name") );
|
||||
cell->setAbutmentBox( stack.as<Box>("_abutmentBox") );
|
||||
|
||||
update( stack, cell );
|
||||
|
|
|
@ -541,6 +541,13 @@ string Contact_Hooks::Locator::_getString() const
|
|||
// JsonContact implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonContact> jsonContactInit ( 0 );
|
||||
|
||||
|
||||
void JsonContact::initialize()
|
||||
// ****************************
|
||||
{ JsonTypes::registerType( new JsonContact (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonContact::JsonContact(unsigned long flags)
|
||||
// ******************************************
|
||||
: JsonComponent(flags)
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/Property.h"
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Property.h"
|
||||
#include "hurricane/Quark.h"
|
||||
#include "hurricane/Error.h"
|
||||
|
||||
|
@ -160,6 +161,9 @@ namespace Hurricane {
|
|||
{
|
||||
writer->key( "+propertySet" );
|
||||
writer->startArray();
|
||||
for ( Property* property : getProperties() ) {
|
||||
if (property->hasJson()) property->toJson( writer, this );
|
||||
}
|
||||
writer->endArray();
|
||||
}
|
||||
|
||||
|
@ -212,7 +216,7 @@ namespace Hurricane {
|
|||
// Class : "Hurricane::JsonDBo".
|
||||
|
||||
JsonDBo::JsonDBo ( unsigned int flags )
|
||||
: JsonObject(flags)
|
||||
: JsonObject(flags | JsonWriter::DBoObject)
|
||||
{ }
|
||||
|
||||
|
||||
|
|
|
@ -17,12 +17,91 @@
|
|||
// not, see <http://www.gnu.org/licenses/>.
|
||||
// ****************************************************************************************************
|
||||
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Warning.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/SharedPath.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Technology.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/UpdateSession.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
using namespace std;
|
||||
using namespace Hurricane;
|
||||
|
||||
|
||||
class CellDepths {
|
||||
public:
|
||||
typedef map<Cell* const,int> CellMap;
|
||||
typedef multimap<int,Cell* const> DepthMap;
|
||||
public:
|
||||
CellDepths ( Library* );
|
||||
inline const DepthMap& getDepths () const;
|
||||
private:
|
||||
void _gatherCells ( Library* );
|
||||
void _computeDepths ();
|
||||
int _computeDepth ( pair<Cell* const,int>& );
|
||||
private:
|
||||
CellMap _cellMap;
|
||||
DepthMap _depthMap;
|
||||
};
|
||||
|
||||
|
||||
inline const CellDepths::DepthMap& CellDepths::getDepths () const { return _depthMap; }
|
||||
|
||||
|
||||
CellDepths::CellDepths ( Library* library )
|
||||
: _cellMap ()
|
||||
, _depthMap()
|
||||
{
|
||||
_gatherCells ( library );
|
||||
_computeDepths();
|
||||
}
|
||||
|
||||
|
||||
void CellDepths::_gatherCells ( Library* library )
|
||||
{
|
||||
for ( Cell* cell : library->getCells() ) _cellMap.insert( make_pair(cell,-1) );
|
||||
|
||||
for ( Library* childLibrary : library->getLibraries() )
|
||||
_gatherCells( childLibrary );
|
||||
}
|
||||
|
||||
|
||||
int CellDepths::_computeDepth ( pair<Cell* const,int>& cellDepth )
|
||||
{
|
||||
if (cellDepth.second != -1) return cellDepth.second;
|
||||
|
||||
int depth = 0;
|
||||
|
||||
if (not cellDepth.first->isTerminal()) {
|
||||
for ( Instance* instance : cellDepth.first->getInstances() ) {
|
||||
Cell* masterCell = instance->getMasterCell();
|
||||
pair<Cell* const,int>& masterDepth = *(_cellMap.find( masterCell ));
|
||||
depth = std::max( depth, _computeDepth(masterDepth)+1 );
|
||||
}
|
||||
}
|
||||
|
||||
cellDepth.second = depth;
|
||||
return cellDepth.second;
|
||||
}
|
||||
|
||||
|
||||
void CellDepths::_computeDepths ()
|
||||
{
|
||||
_depthMap.clear();
|
||||
|
||||
for ( auto cellDepth : _cellMap ) {
|
||||
_computeDepth( cellDepth );
|
||||
_depthMap.insert( make_pair(cellDepth.second,cellDepth.first) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Anonymous namespace.
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
@ -34,6 +113,7 @@ namespace Hurricane {
|
|||
|
||||
DataBase* DataBase::_db = NULL;
|
||||
|
||||
|
||||
DataBase::DataBase()
|
||||
// *****************
|
||||
: Inherit(),
|
||||
|
@ -57,9 +137,10 @@ DataBase* DataBase::create()
|
|||
void DataBase::_postCreate()
|
||||
// *************************
|
||||
{
|
||||
Inherit::_postCreate();
|
||||
Init::runOnce();
|
||||
Inherit::_postCreate();
|
||||
|
||||
_db = this;
|
||||
_db = this;
|
||||
}
|
||||
|
||||
void DataBase::_preDestroy()
|
||||
|
@ -101,11 +182,11 @@ DataBase* DataBase::getDB()
|
|||
return _db;
|
||||
}
|
||||
|
||||
Library* DataBase::getLibrary(string rpath) const
|
||||
// **********************************************
|
||||
Library* DataBase::getLibrary(string rpath, unsigned int flags)
|
||||
// ************************************************************
|
||||
{
|
||||
Library* current = getRootLibrary();
|
||||
if (not current) return NULL;
|
||||
Library* parent = getRootLibrary();
|
||||
if ( not parent and (not (flags & CreateLib)) ) return NULL;
|
||||
|
||||
char separator = SharedPath::getNameSeparator();
|
||||
Name childName;
|
||||
|
@ -113,33 +194,54 @@ Library* DataBase::getLibrary(string rpath) const
|
|||
if (dot != string::npos) {
|
||||
childName = rpath.substr( 0, dot );
|
||||
rpath = rpath.substr( dot+1 );
|
||||
} else
|
||||
} else {
|
||||
childName = rpath;
|
||||
rpath.clear();
|
||||
}
|
||||
|
||||
if (childName != current->getName())
|
||||
if (not parent) {
|
||||
parent = Library::create( this, childName );
|
||||
if (flags & WarnCreateLib) {
|
||||
cerr << Warning( "DataBase::getLibrary(): Creating Root library \"%s\"."
|
||||
, getString(childName).c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
if (childName != parent->getName())
|
||||
return NULL;
|
||||
|
||||
while ( dot != string::npos ) {
|
||||
while ( (dot != string::npos) and parent ) {
|
||||
dot = rpath.find( separator );
|
||||
if (dot != string::npos) {
|
||||
childName = rpath.substr( 0, dot );
|
||||
rpath = rpath.substr( dot+1 );
|
||||
} else
|
||||
} else {
|
||||
childName = rpath;
|
||||
rpath.clear();
|
||||
}
|
||||
|
||||
current = current->getLibrary( childName );
|
||||
Library* child = parent->getLibrary( childName );
|
||||
if ( not child and (flags & CreateLib) ) {
|
||||
child = Library::create( parent, childName );
|
||||
if (flags & WarnCreateLib) {
|
||||
cerr << Warning( "DataBase::getLibrary(): Creating library \"%s\" (parent:\"%s\")."
|
||||
, getString(childName).c_str()
|
||||
, getString(parent->getName()).c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
parent = child;
|
||||
}
|
||||
return current;
|
||||
return parent;
|
||||
}
|
||||
|
||||
Cell* DataBase::getCell(string rpath) const
|
||||
// ****************************************
|
||||
Cell* DataBase::getCell(string rpath, unsigned int flags)
|
||||
// ******************************************************
|
||||
{
|
||||
|
||||
char separator = SharedPath::getNameSeparator();
|
||||
size_t dot = rpath.rfind( separator );
|
||||
string cellName = rpath.substr(dot+1);
|
||||
Library* library = getLibrary( rpath.substr(0,dot) );
|
||||
Library* library = getLibrary( rpath.substr(0,dot), flags );
|
||||
Cell* cell = NULL;
|
||||
|
||||
if (library)
|
||||
|
@ -151,6 +253,61 @@ Cell* DataBase::getCell(string rpath) const
|
|||
|
||||
}
|
||||
|
||||
void DataBase::_toJson(JsonWriter* w) const
|
||||
// ****************************************
|
||||
{
|
||||
Inherit::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_rootLibrary" , _rootLibrary );
|
||||
|
||||
w->key( "+cellsOrderedByDepth" );
|
||||
w->startArray();
|
||||
CellDepths cells = CellDepths( _rootLibrary );
|
||||
for ( auto depthCell : cells.getDepths() ) {
|
||||
depthCell.second->toJson( w );
|
||||
}
|
||||
w->endArray();
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// JsonDataBase implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
|
||||
Initializer<JsonDataBase> jsonDataBaseInit ( 0 );
|
||||
|
||||
|
||||
JsonDataBase::JsonDataBase(unsigned long flags)
|
||||
// ********************************************
|
||||
: JsonDBo(flags)
|
||||
{
|
||||
add( "_rootLibrary", typeid(Library*) );
|
||||
}
|
||||
|
||||
string JsonDataBase::getTypeName() const
|
||||
// *********************************
|
||||
{ return "DataBase"; }
|
||||
|
||||
void JsonDataBase::initialize()
|
||||
// *****************************
|
||||
{ JsonTypes::registerType( new JsonDataBase (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonDataBase* JsonDataBase::clone(unsigned long flags) const
|
||||
// *************************************************
|
||||
{ return new JsonDataBase ( flags ); }
|
||||
|
||||
void JsonDataBase::toData(JsonStack& stack)
|
||||
// ***************************************
|
||||
{
|
||||
check( stack, "JsonDataBase::toData" );
|
||||
|
||||
DataBase* db = DataBase::getDB();
|
||||
|
||||
update( stack, db );
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -132,6 +132,12 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDeepNet".
|
||||
|
||||
Initializer<JsonDeepNet> jsonDeepNetInit ( 0 );
|
||||
|
||||
void JsonDeepNet::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDeepNet (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDeepNet::JsonDeepNet ( unsigned long flags )
|
||||
: JsonNet(flags)
|
||||
{
|
||||
|
|
|
@ -15,9 +15,8 @@
|
|||
|
||||
|
||||
#include <iostream>
|
||||
#include "hurricane/DesignBlob.h"
|
||||
#include "hurricane/DataBase.h"
|
||||
#include "hurricane/Library.h"
|
||||
#include "hurricane/Cell.h"
|
||||
#include "hurricane/DesignBlob.h"
|
||||
|
||||
|
||||
|
@ -35,7 +34,7 @@ namespace Hurricane {
|
|||
w->startObject();
|
||||
jsonWrite( w, "@typename", _getTypeName() );
|
||||
jsonWrite( w, "_topCell" , getTopCell()->getHierarchicalName() );
|
||||
jsonWrite( w, "_library" , DataBase::getDB()->getRootLibrary() );
|
||||
jsonWrite( w, "_database", DataBase::getDB() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
@ -43,13 +42,20 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "JsonDesignBlob".
|
||||
|
||||
Initializer<JsonDesignBlob> jsonDesignBlobInit ( 0 );
|
||||
|
||||
|
||||
void JsonDesignBlob::initialize ()
|
||||
{ JsonTypes::registerType( new JsonDesignBlob (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonDesignBlob::JsonDesignBlob ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
ltrace(51) << "JsonDesignblob::JsonDesignblob()" << endl;
|
||||
|
||||
add( "_library", typeid(Library*) );
|
||||
add( "_topCell", typeid(string) );
|
||||
add( "_topCell" , typeid(string) );
|
||||
add( "_database", typeid(DataBase*) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,7 +71,8 @@ namespace Hurricane {
|
|||
{
|
||||
check( stack, "JsonDesignBlob::toData" );
|
||||
|
||||
DesignBlob* designBlob = new DesignBlob ( DataBase::getDB()->getCell(get<string>(stack,"_topCell")) );
|
||||
DesignBlob* designBlob = new DesignBlob
|
||||
( DataBase::getDB()->getCell( get<string>(stack,"_topCell"), DataBase::NoFlags ) );
|
||||
|
||||
update( stack, designBlob );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
// -*- mode: C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2015, 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 : "./FileReadGzStream.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <bzlib.h>
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/FileReadGzStream.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "FileReadGzStream".
|
||||
|
||||
FileReadGzStream::FileReadGzStream ( std::FILE* fp
|
||||
, char* buffer
|
||||
, size_t bufferSize
|
||||
)
|
||||
: fp_ (fp)
|
||||
, bzfp_ (NULL)
|
||||
, buffer_ (buffer)
|
||||
, bufferSize_(bufferSize)
|
||||
, bufferLast_(0)
|
||||
, current_ (buffer_)
|
||||
, readCount_ (0)
|
||||
, count_ (0)
|
||||
, eof_ (false)
|
||||
, bzerror_ (BZ_OK)
|
||||
{
|
||||
assert(fp_ != 0);
|
||||
assert(bufferSize >= 4);
|
||||
|
||||
bzfp_ = BZ2_bzReadOpen( &bzerror_, fp_, 0, 0, NULL, 0 );
|
||||
if (bzerror_ != BZ_OK) {
|
||||
cerr << Error( "FileReadGzStream::FileReadGzstream(): Unable to initialize bzip2 stream." ) << endl;
|
||||
eof_ = true;
|
||||
}
|
||||
|
||||
Read();
|
||||
}
|
||||
|
||||
|
||||
void FileReadGzStream::Read ()
|
||||
{
|
||||
if (current_ < bufferLast_)
|
||||
++current_;
|
||||
else if (not eof_) {
|
||||
count_ += readCount_;
|
||||
readCount_ = BZ2_bzRead( &bzerror_, bzfp_, buffer_, bufferSize_ );
|
||||
bufferLast_ = buffer_ + readCount_ - 1;
|
||||
current_ = buffer_;
|
||||
|
||||
if (readCount_ < bufferSize_) {
|
||||
buffer_[readCount_] = '\0';
|
||||
++bufferLast_;
|
||||
eof_ = true;
|
||||
}
|
||||
|
||||
if (bzerror_ != BZ_OK) {
|
||||
eof_ = true;
|
||||
if (bzerror_ != BZ_STREAM_END) {
|
||||
cerr << Error( "FileReadGzStream::Read(): Unexpected termination of bzip2 stream." ) << endl;
|
||||
}
|
||||
BZ2_bzReadClose ( &bzerror_, bzfp_ );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -0,0 +1,79 @@
|
|||
// -*- mode: C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2015, 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 : "./FileWriteGzStream.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <bzlib.h>
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/FileWriteGzStream.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "FileWriteGzStream".
|
||||
|
||||
FileWriteGzStream::FileWriteGzStream ( std::FILE* fp
|
||||
, char* buffer
|
||||
, size_t bufferSize
|
||||
)
|
||||
: fp_ (fp)
|
||||
, bzfp_ (NULL)
|
||||
, buffer_ (buffer)
|
||||
, bufferEnd_(buffer + bufferSize), current_(buffer_)
|
||||
, bzerror_ (BZ_OK)
|
||||
{
|
||||
assert(fp_ != 0);
|
||||
|
||||
bzfp_ = BZ2_bzWriteOpen( &bzerror_, fp_, 9, 0, 0 );
|
||||
if (bzerror_ != BZ_OK) {
|
||||
cerr << Error( "FileWriteGzStream::FileWriteGzstream(): Unable to initialize bzip2 stream." ) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FileWriteGzStream::~FileWriteGzStream ()
|
||||
{
|
||||
if (not bzfp_) return;
|
||||
|
||||
unsigned int bytesin = 0;
|
||||
unsigned int bytesout = 0;
|
||||
|
||||
BZ2_bzWriteClose( &bzerror_, bzfp_, 0, &bytesin, &bytesout );
|
||||
if (bzerror_ != BZ_OK) {
|
||||
cerr << Error( "FileWriteGzStream::~FileWritegzstream(): I/O error while closing stream." ) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FileWriteGzStream::Flush ()
|
||||
{
|
||||
if (current_ != buffer_) {
|
||||
BZ2_bzWrite( &bzerror_,bzfp_, buffer_, static_cast<int>(current_ - buffer_) );
|
||||
if (bzerror_ != BZ_OK) {
|
||||
unsigned int bytesin = 0;
|
||||
unsigned int bytesout = 0;
|
||||
|
||||
BZ2_bzWriteClose( &bzerror_, bzfp_, 0, &bytesin, &bytesout );
|
||||
if (bzerror_ != BZ_OK) {
|
||||
cerr << Error( "FileWriteGzStream::Write(): I/O error in bzip2 stream." ) << endl;
|
||||
}
|
||||
}
|
||||
current_ = buffer_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -208,6 +208,13 @@ Record* Horizontal::_getRecord() const
|
|||
// JsonHorizontal implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonHorizontal> jsonHorizontalInit ( 0 );
|
||||
|
||||
|
||||
void JsonHorizontal::initialize()
|
||||
// *******************************
|
||||
{ JsonTypes::registerType( new JsonHorizontal (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonHorizontal::JsonHorizontal(unsigned long flags)
|
||||
// ************************************************
|
||||
: JsonSegment(flags)
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2015-2015, 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 |
|
||||
// | |
|
||||
// | Authors : Jean-Paul Chaput |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./Initializer.cpp" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "hurricane/Initializer.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Init".
|
||||
|
||||
bool Init::_run = false;
|
||||
Init::InitializerMap* Init::_initializers = NULL;
|
||||
|
||||
|
||||
void Init::destroy ()
|
||||
{
|
||||
if (_initializers) delete _initializers;
|
||||
_initializers = NULL;
|
||||
_run = false;
|
||||
}
|
||||
|
||||
|
||||
Init::InitializerMap& Init::initializers ()
|
||||
{
|
||||
if (not _initializers) _initializers = new InitializerMap();
|
||||
return *_initializers;
|
||||
}
|
||||
|
||||
|
||||
void Init::addInitializer ( unsigned int order,initializer_t initFunction )
|
||||
{ initializers().insert( make_pair(order,initFunction) ); }
|
||||
|
||||
|
||||
bool Init::runOnce ()
|
||||
{
|
||||
if (_run) return false;
|
||||
|
||||
for ( auto init : initializers() ) init.second();
|
||||
_run = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
|
@ -498,9 +498,10 @@ void Instance::uniquify()
|
|||
|
||||
if (not _getSharedPathMap().isEmpty()) {
|
||||
cerr << Warning( "Instance::uniquify(): While uniquifying model %s of instance %s, SharedPathMap is not empty.\n"
|
||||
" (Entity's Occurrences will still uses the original master Cell)"
|
||||
" (%u Entity's Occurrences will still uses the original master Cell)"
|
||||
, getString(_masterCell->getName()).c_str()
|
||||
, getString(getName()).c_str()
|
||||
, _getSharedPathMap()._getSize()
|
||||
) << endl;
|
||||
}
|
||||
|
||||
|
@ -754,6 +755,12 @@ Record* Instance::PlacementStatus::_getRecord() const
|
|||
// JsonInstance implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonInstance> jsonInstanceInit ( 0 );
|
||||
|
||||
void JsonInstance::initialize()
|
||||
// *****************************
|
||||
{ JsonTypes::registerType( new JsonInstance (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonInstance::JsonInstance(unsigned long flags)
|
||||
// ********************************************
|
||||
: JsonEntity(flags)
|
||||
|
@ -782,7 +789,7 @@ void JsonInstance::toData(JsonStack& stack)
|
|||
Instance* instance = Instance::create
|
||||
( get<Cell* >(stack,".Cell")
|
||||
, get<string>(stack,"_name")
|
||||
, DataBase::getDB()->getCell( get<string>(stack,"_masterCell") )
|
||||
, DataBase::getDB()->getCell( get<string>(stack,"_masterCell"), DataBase::NoFlags )
|
||||
, get<Transformation>(stack,"_transformation")
|
||||
, Instance::PlacementStatus(get<string>(stack,"_placementStatus") )
|
||||
);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#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/Warning.h"
|
||||
#include "hurricane/JsonReader.h"
|
||||
|
@ -112,14 +114,14 @@ namespace {
|
|||
JsonReader ( const JsonReader& );
|
||||
JsonReader& operator= ( const JsonReader& ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
FileReadStream* _stream;
|
||||
JsonStack _stack;
|
||||
Reader _reader;
|
||||
HurricaneHandler _handler;
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
FileReadGzStream* _stream;
|
||||
JsonStack _stack;
|
||||
Reader _reader;
|
||||
HurricaneHandler _handler;
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,7 +152,8 @@ namespace {
|
|||
bool HurricaneHandler::Null ()
|
||||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<void*>( _key, NULL );
|
||||
stack().push_back<DBo*>( _key, (DBo*)NULL );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -159,6 +162,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<bool>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -167,6 +171,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<int64_t>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -175,6 +180,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<int64_t>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -183,6 +189,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<int64_t>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -191,6 +198,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<int64_t>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -199,6 +207,7 @@ namespace {
|
|||
{
|
||||
if (isDummy()) return true;
|
||||
stack().push_back<double>( _key, v );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -211,6 +220,7 @@ namespace {
|
|||
|
||||
if (_key != "@typename") {
|
||||
cerr << Warning("JsonReader::parse(): First field is not @typename, skipping object." ) << endl;
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -239,10 +249,12 @@ namespace {
|
|||
}
|
||||
|
||||
ltrace(51) << "HurricaneHandler::String() [key/typename] \"" << value << "\"." << endl;
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
stack().push_back<string>( _key, value );
|
||||
_key.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -276,8 +288,9 @@ namespace {
|
|||
ltracein(50);
|
||||
|
||||
_state |= TypenameKey;
|
||||
_objectName = (_key == ".Array") ? "" : _key;
|
||||
_objectName = _key;
|
||||
_objects.push_back( new JsonDummy() );
|
||||
_key.clear();
|
||||
ltrace(51) << "_objects.push_back(NULL), size():" << _objects.size() << "." << endl;
|
||||
|
||||
ltracein(50);
|
||||
|
@ -302,11 +315,12 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
//if (_objects.size() > 1) {
|
||||
ltrace(51) << "_objects.pop_back(), size():" << _objects.size() << "." << endl;
|
||||
delete _objects.back();
|
||||
_objects.pop_back();
|
||||
//}
|
||||
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();
|
||||
|
||||
ltraceout(50);
|
||||
return true;
|
||||
|
@ -323,20 +337,16 @@ namespace {
|
|||
cerr << Warning("JsonReader::parse(): Array attributes must start by \'+\' %s.", _key.c_str() ) << endl;
|
||||
return true;
|
||||
}
|
||||
_key.clear();
|
||||
|
||||
_key = ".Array";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool HurricaneHandler::EndArray ( SizeType )
|
||||
{
|
||||
ltraceout(50);
|
||||
ltrace(50) << "HurricaneHandler::EndArray()" << endl;
|
||||
ltracein(50);
|
||||
|
||||
_key.clear();
|
||||
|
||||
ltraceout(50);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -382,9 +392,9 @@ namespace {
|
|||
{
|
||||
close();
|
||||
|
||||
DebugSession::open( 50 );
|
||||
//DebugSession::open( 50 );
|
||||
|
||||
fileName += ".json";
|
||||
fileName += ".json.bz2";
|
||||
_file = fopen( fileName.c_str(), "r" );
|
||||
ltrace(50) << "_file:" << _file << ", _buffer:" << (void*)_buffer << endl;
|
||||
|
||||
|
@ -393,7 +403,7 @@ namespace {
|
|||
, fileName.c_str() );
|
||||
}
|
||||
|
||||
_stream = new FileReadStream ( _file, _buffer, _bufferSize );
|
||||
_stream = new FileReadGzStream ( _file, _buffer, _bufferSize );
|
||||
|
||||
if (issetFlags(JsonWriter::DesignBlobMode))
|
||||
Entity::enableForcedIdMode();
|
||||
|
@ -402,8 +412,10 @@ namespace {
|
|||
if (issetFlags(JsonWriter::DesignBlobMode))
|
||||
Entity::disableForcedIdMode();
|
||||
|
||||
DebugSession::close();
|
||||
//DebugSession::close();
|
||||
close();
|
||||
|
||||
SharedProperty::clearOrphaneds();
|
||||
}
|
||||
|
||||
|
||||
|
@ -588,6 +600,8 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "JsonTypes".
|
||||
|
||||
Initializer<JsonTypes> jsonTypesInitialize ( 10 );
|
||||
|
||||
JsonTypes* JsonTypes::_jsonTypes = NULL;
|
||||
|
||||
|
||||
|
@ -635,29 +649,7 @@ namespace Hurricane {
|
|||
|
||||
|
||||
void JsonTypes::initialize ()
|
||||
{
|
||||
if (_jsonTypes) return;
|
||||
|
||||
_jsonTypes = new JsonTypes ();
|
||||
_jsonTypes->_registerType( new JsonPoint (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonBox (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonTransformation(JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonLibrary (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonCell (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonNet (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonDeepNet (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonPlugRef (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonRoutingPad (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonContact (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonVertical (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonHorizontal (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonPad (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonInstance (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonPlug (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonOccurrence (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonSignature (JsonWriter::RegisterMode) );
|
||||
_jsonTypes->_registerType( new JsonDesignBlob (JsonWriter::RegisterMode) );
|
||||
}
|
||||
{ if (not _jsonTypes) _jsonTypes = new JsonTypes (); }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
|
|
@ -29,14 +29,16 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "rapidjson/filewritestream.h"
|
||||
//#include "rapidjson/filewritestream.h"
|
||||
#include "rapidjson/prettywriter.h"
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/FileWriteGzStream.h"
|
||||
|
||||
|
||||
//namespace Hurricane {
|
||||
|
||||
typedef rapidjson::PrettyWriter<rapidjson::FileWriteStream> JsonOfstream;
|
||||
//typedef rapidjson::PrettyWriter<rapidjson::FileWriteStream> JsonOfstream;
|
||||
typedef rapidjson::PrettyWriter<Hurricane::FileWriteGzStream> JsonOfstream;
|
||||
|
||||
#define _WRITER reinterpret_cast<JsonOfstream*>(_writer)
|
||||
|
||||
|
@ -53,7 +55,8 @@
|
|||
, _writer (NULL)
|
||||
{
|
||||
_file = fopen( fileName.c_str(), "w" );
|
||||
_stream = new rapidjson::FileWriteStream ( _file, _buffer, _bufferSize );
|
||||
//_stream = new rapidjson::FileWriteGzStream ( _file, _buffer, _bufferSize );
|
||||
_stream = new Hurricane::FileWriteGzStream ( _file, _buffer, _bufferSize );
|
||||
_writer = new JsonOfstream ( *_stream );
|
||||
_WRITER->SetIndent( ' ', 2 );
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ void Library::_toJson(JsonWriter* w) const
|
|||
Inherit::_toJson( w );
|
||||
|
||||
jsonWrite( w, "_name" , getName() );
|
||||
jsonWrite( w, "+cellMap" , getCells() );
|
||||
//jsonWrite( w, "+cellMap" , getCells() );
|
||||
jsonWrite( w, "+libraryMap", getLibraries() );
|
||||
}
|
||||
|
||||
|
@ -243,13 +243,19 @@ void Library::_toJson(JsonWriter* w) const
|
|||
// JsonLibrary implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonLibrary> jsonLibraryInit ( 0 );
|
||||
|
||||
void JsonLibrary::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonLibrary (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonLibrary::JsonLibrary(unsigned long flags)
|
||||
// ************************************
|
||||
: JsonDBo(flags)
|
||||
{
|
||||
add( ".Library" , typeid(Library*) );
|
||||
//add( ".Library" , typeid(Library*) );
|
||||
add( "_name" , typeid(string) );
|
||||
add( "+cellMap" , typeid(JsonArray) );
|
||||
//add( "+cellMap" , typeid(JsonArray) );
|
||||
add( "+libraryMap", typeid(JsonArray) );
|
||||
}
|
||||
|
||||
|
@ -267,11 +273,14 @@ void JsonLibrary::toData(JsonStack& stack)
|
|||
check( stack, "JsonLibrary::toData" );
|
||||
|
||||
Name libName ( get<string> ( stack, "_name" ) );
|
||||
Library* parent = get<Library*>( stack, ".Library" );
|
||||
if (not parent)
|
||||
parent = get<Library*>( stack, "_library" );
|
||||
|
||||
Library* library = NULL;
|
||||
Library* parent = NULL;
|
||||
|
||||
if (stack.rhas(".Library"))
|
||||
parent = get<Library*>( stack, ".Library" );
|
||||
else if (stack.rhas("_rootLibrary"))
|
||||
parent = get<Library*>( stack, "_rootLibrary" );
|
||||
|
||||
if (parent) {
|
||||
library = parent->getLibrary( libName );
|
||||
if (not library)
|
||||
|
|
|
@ -267,14 +267,14 @@ Net::Net(Cell* cell, const Name& name)
|
|||
_nextOfCellNetMap(NULL),
|
||||
_mainName(this)
|
||||
{
|
||||
if (!_cell)
|
||||
throw Error("Can't create " + _TName("Net") + " : null cell");
|
||||
if (!_cell)
|
||||
throw Error("Can't create " + _TName("Net") + " : null cell");
|
||||
|
||||
if (name.isEmpty())
|
||||
throw Error("Can't create " + _TName("Net") + " : empty name");
|
||||
if (name.isEmpty())
|
||||
throw Error("Can't create " + _TName("Net") + " : empty name");
|
||||
|
||||
if (_cell->getNet(_name))
|
||||
throw Error("Can't create " + _TName("Net ") + getString(_name) + " : already exists");
|
||||
if (_cell->getNet(_name))
|
||||
throw Error("Can't create " + _TName("Net ") + getString(_name) + " : already exists");
|
||||
}
|
||||
|
||||
Net* Net::create(Cell* cell, const Name& name)
|
||||
|
@ -1064,6 +1064,12 @@ string Net_SlavePlugs::Locator::_getString() const
|
|||
// JsonNet implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonNet> jsonNetInit ( 0 );
|
||||
|
||||
void JsonNet::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonNet (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonNet::JsonNet(unsigned long flags)
|
||||
// **********************************
|
||||
: JsonEntity (flags)
|
||||
|
|
|
@ -14,8 +14,9 @@
|
|||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#include "hurricane/NetRoutingProperty.h"
|
||||
#include "hurricane/Net.h"
|
||||
#include "hurricane/NetRoutingProperty.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Net.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
@ -24,13 +25,18 @@ namespace Hurricane {
|
|||
using Hurricane::Property;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "NetRoutingState"
|
||||
|
||||
string NetRoutingState::_getString () const
|
||||
{
|
||||
string s;
|
||||
|
||||
if (isFixed ()) s += 'f';
|
||||
if (isManualGlobalRoute ()) s += 'm';
|
||||
if (isAutomaticGlobalRoute()) s += 'a';
|
||||
s += (isExcluded ()) ? 'e' : '-';
|
||||
s += (isFixed ()) ? 'f' : '-';
|
||||
s += (isUnconnected ()) ? 'u' : '-';
|
||||
s += (isManualGlobalRoute ()) ? 'm' : '-';
|
||||
s += (isAutomaticGlobalRoute()) ? 'a' : '-';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -101,6 +107,88 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
bool NetRoutingProperty::hasJson () const
|
||||
{ return true; }
|
||||
|
||||
|
||||
void NetRoutingProperty::toJson ( JsonWriter* w, const DBo* ) const
|
||||
{
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", _getTypeName() );
|
||||
jsonWrite( w, "_state" , _state._getString() );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "JsonNetRoutingProperty"
|
||||
|
||||
Initializer<JsonNetRoutingProperty> jsonNetRoutingPropertyInit ( 20 );
|
||||
|
||||
|
||||
JsonNetRoutingProperty::JsonNetRoutingProperty ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
add( "_state", typeid(string) );
|
||||
}
|
||||
|
||||
|
||||
string JsonNetRoutingProperty::getTypeName () const
|
||||
{ return "NetRoutingProperty"; }
|
||||
|
||||
|
||||
void JsonNetRoutingProperty::initialize ()
|
||||
{ JsonTypes::registerType( new JsonNetRoutingProperty (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonNetRoutingProperty* JsonNetRoutingProperty::clone ( unsigned long flags ) const
|
||||
{ return new JsonNetRoutingProperty ( flags ); }
|
||||
|
||||
|
||||
void JsonNetRoutingProperty::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonNetRoutingProperty::toData" );
|
||||
|
||||
string sflags = get<string>( stack, "_state" );
|
||||
unsigned int flags = 0;
|
||||
|
||||
flags |= (sflags[0] == 'e') ? NetRoutingState::Excluded : 0;
|
||||
flags |= (sflags[1] == 'f') ? NetRoutingState::Fixed : 0;
|
||||
flags |= (sflags[2] == 'u') ? NetRoutingState::Unconnected : 0;
|
||||
flags |= (sflags[3] == 'm') ? NetRoutingState::ManualGlobalRoute : 0;
|
||||
flags |= (sflags[4] == 'a') ? NetRoutingState::AutomaticGlobalRoute : 0;
|
||||
|
||||
NetRoutingProperty* property = NULL;
|
||||
DBo* dbo = stack.back_dbo();
|
||||
if (dbo) {
|
||||
Net* net = dynamic_cast<Net*>( dbo );
|
||||
if (net) {
|
||||
property = dynamic_cast<NetRoutingProperty*>( net->getProperty( NetRoutingProperty::getPropertyName() ) );
|
||||
if (property) {
|
||||
cerr << Error( "JsonNetRoutingProperty::toData(): %s has already a NetRoutingProperty (overwrite)."
|
||||
, getString(net).c_str()
|
||||
) << endl;
|
||||
NetRoutingState* state = property->getState();
|
||||
state->unsetFlags( (unsigned int)-1 );
|
||||
state->setFlags( flags );
|
||||
} else {
|
||||
property = NetRoutingProperty::create( net );
|
||||
property->getState()->setFlags( flags );
|
||||
net->put( property );
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonNetRoutingProperty::toData(): %s must be a Net."
|
||||
, getString(dbo).c_str()
|
||||
) << endl;
|
||||
}
|
||||
} else {
|
||||
cerr << Error( "JsonNetRoutingProperty::toData(): No DBo in stack to attach to." ) << endl;
|
||||
}
|
||||
|
||||
update( stack, property );
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "NetRoutingExtension"
|
||||
|
||||
|
|
|
@ -34,23 +34,23 @@ namespace Hurricane {
|
|||
// ****************************************************************************************************
|
||||
|
||||
Occurrence::Occurrence(const Entity* entity)
|
||||
// *********************************
|
||||
: _entity(const_cast<Entity*>(entity)),
|
||||
_sharedPath(NULL)
|
||||
// *****************************************
|
||||
: _entity(const_cast<Entity*>(entity))
|
||||
, _sharedPath(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
Occurrence::Occurrence(const Entity* entity, const Path& path)
|
||||
// ***************************************************
|
||||
: _entity(const_cast<Entity*>(entity)),
|
||||
_sharedPath(path._getSharedPath())
|
||||
// ***********************************************************
|
||||
: _entity(const_cast<Entity*>(entity))
|
||||
, _sharedPath(path._getSharedPath())
|
||||
{
|
||||
if (!_entity) {
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : null entity");
|
||||
}
|
||||
if (_sharedPath)
|
||||
if (_entity->getCell() != _sharedPath->getMasterCell())
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : incompatible path");
|
||||
if (!_entity) {
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : null entity");
|
||||
}
|
||||
if (_sharedPath)
|
||||
if (_entity->getCell() != _sharedPath->getMasterCell())
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : incompatible path");
|
||||
}
|
||||
|
||||
Occurrence::Occurrence(const Occurrence& occurrence)
|
||||
|
@ -324,6 +324,14 @@ string Occurrence::getName() const
|
|||
return description;
|
||||
}
|
||||
|
||||
|
||||
Initializer<JsonOccurrence> jsonOccurrenceInit ( 0 );
|
||||
|
||||
|
||||
void JsonOccurrence::initialize()
|
||||
// *******************************
|
||||
{ JsonTypes::registerType( new JsonOccurrence (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonOccurrence::JsonOccurrence(unsigned long flags)
|
||||
// ************************************************
|
||||
: JsonObject(flags)
|
||||
|
|
|
@ -153,6 +153,13 @@ Record* Pad::_getRecord() const
|
|||
// JsonPad implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonPad> jsonPadInit ( 0 );
|
||||
|
||||
|
||||
void JsonPad::initialize()
|
||||
// ************************
|
||||
{ JsonTypes::registerType( new JsonPad (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonPad::JsonPad(unsigned long flags)
|
||||
// **********************************
|
||||
: JsonComponent(flags)
|
||||
|
|
|
@ -236,6 +236,13 @@ string Plug::getName() const
|
|||
// JsonPlug implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonPlug> jsonPlugInit ( 0 );
|
||||
|
||||
|
||||
void JsonPlug::initialize()
|
||||
// *************************
|
||||
{ JsonTypes::registerType( new JsonPlug (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonPlug::JsonPlug(unsigned long flags)
|
||||
// ************************************
|
||||
: JsonComponent(flags)
|
||||
|
@ -294,6 +301,12 @@ void JsonPlug::toData(JsonStack& stack)
|
|||
// JsonPlugRef implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonPlugRef> jsonPlugRefInit ( 0 );
|
||||
|
||||
void JsonPlugRef::initialize()
|
||||
// ****************************
|
||||
{ JsonTypes::registerType( new JsonPlugRef (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonPlugRef::JsonPlugRef(unsigned long flags)
|
||||
// ******************************************
|
||||
: JsonObject(flags)
|
||||
|
|
|
@ -126,6 +126,7 @@ Record* Point::_getRecord() const
|
|||
void Point::toJson ( JsonWriter* w ) const
|
||||
// ****************************************
|
||||
{
|
||||
|
||||
w->startObject();
|
||||
jsonWrite( w, "@typename", "Point" );
|
||||
jsonWrite( w, "_x", getX() );
|
||||
|
@ -133,6 +134,12 @@ void Point::toJson ( JsonWriter* w ) const
|
|||
w->endObject();
|
||||
}
|
||||
|
||||
Initializer<JsonPoint> jsonPointInit ( 0 );
|
||||
|
||||
void JsonPoint::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonPoint (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonPoint::JsonPoint(unsigned long flags)
|
||||
// **************************************
|
||||
: JsonObject(flags)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2015, All Rights Reserved
|
||||
|
@ -86,6 +85,13 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
bool Property::hasJson () const
|
||||
{ return false; }
|
||||
|
||||
|
||||
void Property::toJson ( JsonWriter*, const DBo* ) const
|
||||
{ }
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::PrivateProperty".
|
||||
|
||||
|
@ -141,6 +147,76 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::SharedProperty".
|
||||
|
||||
SharedProperty::OrphanedMap SharedProperty::_orphaneds;
|
||||
|
||||
|
||||
const SharedProperty::OrphanedMap& SharedProperty::getOrphaneds ()
|
||||
{ return _orphaneds; }
|
||||
|
||||
|
||||
SharedProperty* SharedProperty::getOrphaned ( const string& tag )
|
||||
{
|
||||
auto iorphaned = _orphaneds.find( tag );
|
||||
if (iorphaned != _orphaneds.end()) return (*iorphaned).second._property;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void SharedProperty::addOrphaned ( const string& tag, SharedProperty* property )
|
||||
{
|
||||
auto iorphaned = _orphaneds.find( tag );
|
||||
if (iorphaned == _orphaneds.end()) {
|
||||
_orphaneds.insert( make_pair(tag,Orphaned(property)) );
|
||||
} else {
|
||||
if ((*iorphaned).second._property != property) {
|
||||
cerr << Error( "SharedProperty::addOrphaned(): Multiple properties with the same tag \"%s\"."
|
||||
, tag.c_str()
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SharedProperty::refOrphaned ( const string& tag )
|
||||
{
|
||||
auto iorphaned = _orphaneds.find( tag );
|
||||
if (iorphaned != _orphaneds.end()) {
|
||||
(*iorphaned).second._refcount++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SharedProperty::countOrphaned ( const string& tag , unsigned int count )
|
||||
{
|
||||
auto iorphaned = _orphaneds.find( tag );
|
||||
if (iorphaned != _orphaneds.end()) {
|
||||
(*iorphaned).second._count = count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SharedProperty::removeOrphaned ( const string& tag )
|
||||
{
|
||||
auto iorphaned = _orphaneds.find( tag );
|
||||
if (iorphaned != _orphaneds.end()) _orphaneds.erase( iorphaned );
|
||||
}
|
||||
|
||||
|
||||
void SharedProperty::clearOrphaneds ()
|
||||
{
|
||||
for ( auto element : _orphaneds ) {
|
||||
if (element.second._refcount != element.second._count) {
|
||||
cerr << Error( "SharedProperty::clearOrphaneds(): On tag \"%s\", count:%u refcount:%u."
|
||||
, element.first.c_str()
|
||||
, element.second._count
|
||||
, element.second._refcount
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
_orphaneds.clear();
|
||||
}
|
||||
|
||||
|
||||
SharedProperty::SharedProperty ()
|
||||
: Property()
|
||||
|
|
|
@ -403,6 +403,13 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "JsonRoutingPad".
|
||||
|
||||
Initializer<JsonRoutingPad> jsonRoutingPadInit ( 0 );
|
||||
|
||||
|
||||
void JsonRoutingPad::initialize ()
|
||||
{ JsonTypes::registerType( new JsonRoutingPad (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonRoutingPad::JsonRoutingPad ( unsigned long flags )
|
||||
: JsonComponent(flags)
|
||||
{
|
||||
|
|
|
@ -59,6 +59,13 @@ namespace Hurricane {
|
|||
// -------------------------------------------------------------------
|
||||
// Class : "JsonSignature".
|
||||
|
||||
Initializer<JsonSignature> jsonSignatureInit ( 0 );
|
||||
|
||||
|
||||
void JsonSignature::initialize ()
|
||||
{ JsonTypes::registerType( new JsonSignature (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
JsonSignature::JsonSignature ( unsigned long flags )
|
||||
: JsonObject (flags)
|
||||
, _subTypeName("unset")
|
||||
|
|
|
@ -320,9 +320,15 @@ Record* Transformation::Orientation::_getRecord() const
|
|||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Transformation::Orientation implementation
|
||||
// JsonTransformation implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonTransformation> jsonTransformationInit ( 0 );
|
||||
|
||||
void JsonTransformation::initialize()
|
||||
// **************************
|
||||
{ JsonTypes::registerType( new JsonTransformation (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonTransformation::JsonTransformation(unsigned long flags)
|
||||
// ********************************************************
|
||||
: JsonObject(flags)
|
||||
|
|
|
@ -36,8 +36,7 @@ stack<UpdateSession*>* UPDATOR_STACK = NULL;
|
|||
UpdateSession::UpdateSession()
|
||||
// ***************************
|
||||
: Inherit()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
void UpdateSession::destroy()
|
||||
// *************************
|
||||
|
@ -126,9 +125,9 @@ Record* UpdateSession::_getRecord() const
|
|||
return record;
|
||||
}
|
||||
|
||||
void UpdateSession::onCapturedBy(DBo* owner)
|
||||
// *****************************************
|
||||
{
|
||||
void UpdateSession::onCapturedBy(DBo* owner)
|
||||
// *****************************************
|
||||
{
|
||||
if ( not dynamic_cast<Go*>(owner) and not dynamic_cast<Cell*>(owner) )
|
||||
throw Error( "Bad update session capture : not a graphic object (Go) or a Cell" );
|
||||
|
||||
|
@ -137,8 +136,7 @@ Record* UpdateSession::_getRecord() const
|
|||
|
||||
void UpdateSession::onNotOwned()
|
||||
// *****************************
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
|
||||
|
||||
|
@ -146,9 +144,9 @@ void UpdateSession::onNotOwned()
|
|||
// Go::invalidate implementation : located here to access UPDATOR_STACK variable
|
||||
// ****************************************************************************************************
|
||||
|
||||
void Go::invalidate(bool propagateFlag)
|
||||
// ************************************
|
||||
{
|
||||
void Go::invalidate(bool propagateFlag)
|
||||
// ************************************
|
||||
{
|
||||
// trace << "invalidate(" << this << ")" << endl;
|
||||
// trace_in();
|
||||
|
||||
|
|
|
@ -211,6 +211,13 @@ Record* Vertical::_getRecord() const
|
|||
// JsonVertical implementation
|
||||
// ****************************************************************************************************
|
||||
|
||||
Initializer<JsonVertical> jsonVerticalInit ( 0 );
|
||||
|
||||
|
||||
void JsonVertical::initialize()
|
||||
// *****************************
|
||||
{ JsonTypes::registerType( new JsonVertical (JsonWriter::RegisterMode) ); }
|
||||
|
||||
JsonVertical::JsonVertical(unsigned long flags)
|
||||
// ********************************************
|
||||
: JsonSegment(flags)
|
||||
|
|
|
@ -130,6 +130,7 @@ class Box {
|
|||
class JsonBox : public JsonObject {
|
||||
// ********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonBox(unsigned long);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonBox* clone(unsigned long) const;
|
||||
|
|
|
@ -110,15 +110,39 @@ class Cell : public Entity {
|
|||
virtual Name getName () const;
|
||||
static Name staticGetName ();
|
||||
Name getUniqueName ();
|
||||
static std::string getTrunkName ( Name name );
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter*, const DBo* ) const;
|
||||
inline void _setOwner ( Cell* );
|
||||
inline void _setDuplicates ( unsigned int );
|
||||
virtual string _getTypeName () const;
|
||||
virtual Record* _getRecord () const;
|
||||
private:
|
||||
static const Name _name;
|
||||
unsigned int _duplicates;
|
||||
unsigned int _duplicates;
|
||||
private:
|
||||
UniquifyRelation ( Cell* );
|
||||
protected:
|
||||
virtual void _preDestroy ();
|
||||
|
||||
public:
|
||||
class JsonProperty : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonProperty ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonProperty* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
public:
|
||||
class JsonPropertyRef : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonPropertyRef ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonPropertyRef* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
};
|
||||
|
||||
class ClonedSet : public Collection<Cell*> {
|
||||
|
@ -446,9 +470,14 @@ inline Cell::ClonedSet::ClonedSet ( const ClonedSet& other )
|
|||
{ }
|
||||
|
||||
|
||||
inline void Cell::UniquifyRelation::_setOwner ( Cell* owner ) { _setMasterOwner(owner); }
|
||||
inline void Cell::UniquifyRelation::_setDuplicates ( unsigned int duplicates ) { _duplicates=duplicates; }
|
||||
|
||||
|
||||
class JsonCell : public JsonEntity {
|
||||
// *********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonCell(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonCell* clone(unsigned long) const;
|
||||
|
|
|
@ -739,6 +739,7 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
|
|||
// x-----------------------------------------------------------------x
|
||||
|
||||
#include "hurricane/Slot.h"
|
||||
#include "hurricane/Initializer.h"
|
||||
#include "hurricane/Tabulation.h"
|
||||
#include "hurricane/JsonWriter.h"
|
||||
#include "hurricane/JsonReader.h"
|
||||
|
|
|
@ -152,6 +152,7 @@ class Contact : public Component {
|
|||
class JsonContact : public JsonComponent {
|
||||
// ***************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonContact(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonContact* clone(unsigned long) const;
|
||||
|
|
|
@ -89,8 +89,16 @@ namespace Hurricane {
|
|||
|
||||
class JsonDBo : public JsonObject {
|
||||
public:
|
||||
JsonDBo ( unsigned int flags );
|
||||
};
|
||||
JsonDBo ( unsigned int flags );
|
||||
template<typename T> inline void update ( JsonStack&, T );
|
||||
};
|
||||
|
||||
|
||||
template<typename T> inline void JsonDBo::update ( JsonStack& stack, T hobject )
|
||||
{
|
||||
JsonObject::update<T>( stack, hobject );
|
||||
stack.push_back_dbo( dynamic_cast<DBo*>(hobject) );
|
||||
}
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define HURRICANE_DATA_BASE
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include "hurricane/DBo.h"
|
||||
#include "hurricane/DbU.h"
|
||||
|
||||
|
@ -43,6 +44,9 @@ class DataBase : public DBo {
|
|||
// *****
|
||||
|
||||
public: typedef DBo Inherit;
|
||||
public: enum Flags { NoFlags = 0
|
||||
, CreateLib =(1<<0)
|
||||
, WarnCreateLib=(1<<2) };
|
||||
|
||||
// Attributes
|
||||
// **********
|
||||
|
@ -64,6 +68,7 @@ class DataBase : public DBo {
|
|||
|
||||
protected: virtual void _preDestroy();
|
||||
|
||||
public: virtual void _toJson(JsonWriter*) const;
|
||||
public: virtual string _getTypeName() const {return _TName("DataBase");};
|
||||
public: virtual string _getString() const;
|
||||
public: virtual Record* _getRecord() const;
|
||||
|
@ -79,12 +84,29 @@ class DataBase : public DBo {
|
|||
|
||||
public: Technology* getTechnology() const {return _technology;};
|
||||
public: Library* getRootLibrary() const {return _rootLibrary;};
|
||||
public: Library* getLibrary(string) const;
|
||||
public: Cell* getCell(string) const;
|
||||
public: Library* getLibrary(string,unsigned int flags);
|
||||
public: Cell* getCell(string, unsigned int flags);
|
||||
public: static DataBase* getDB();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// JsonDataBase declaration
|
||||
// ****************************************************************************************************
|
||||
|
||||
class JsonDataBase : public JsonDBo {
|
||||
// ********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonDataBase(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonDataBase* clone(unsigned long) const;
|
||||
public: virtual void toData(JsonStack&);
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace Hurricane {
|
|||
|
||||
class JsonDeepNet : public JsonNet {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDeepNet ( unsigned long flags );
|
||||
virtual ~JsonDeepNet ();
|
||||
virtual string getTypeName () const;
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace Hurricane {
|
|||
|
||||
class JsonDesignBlob : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonDesignBlob ( unsigned long flags );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonDesignBlob* clone ( unsigned long ) const;
|
||||
|
|
|
@ -87,14 +87,14 @@ namespace Hurricane {
|
|||
public:
|
||||
JsonEntity ( unsigned long flags );
|
||||
template<typename T> inline void update ( JsonStack&, T );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<typename T> inline void JsonEntity::update ( JsonStack& stack, T hobject )
|
||||
{
|
||||
unsigned int jsonId = get<int64_t>(stack,"_id");
|
||||
|
||||
JsonObject::update<T>( stack, hobject );
|
||||
JsonDBo::update<T>( stack, hobject );
|
||||
stack.addEntity( jsonId, hobject );
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
// -*- mode: C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2015, 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/FileReadGzStream.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_FILEREADGZSTREAM_H
|
||||
#define HURRICANE_FILEREADGZSTREAM_H
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
typedef void BZFILE; // Must be identical to the typedef in <bzlib.h>.
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "FileReadGzStream".
|
||||
|
||||
class FileReadGzStream {
|
||||
public:
|
||||
typedef char Ch;
|
||||
public:
|
||||
FileReadGzStream ( std::FILE* fp
|
||||
, char* buffer
|
||||
, size_t bufferSize
|
||||
);
|
||||
inline Ch Peek () const;
|
||||
inline Ch Take ();
|
||||
inline size_t Tell () const;
|
||||
inline void Put ( Ch );
|
||||
inline void Flush ();
|
||||
inline Ch* PutBegin ();
|
||||
inline size_t PutEnd ( Ch* );
|
||||
inline const Ch* Peek4 () const;
|
||||
private:
|
||||
void Read ();
|
||||
private:
|
||||
std::FILE* fp_;
|
||||
BZFILE* bzfp_;
|
||||
Ch* buffer_;
|
||||
size_t bufferSize_;
|
||||
Ch* bufferLast_;
|
||||
Ch* current_;
|
||||
size_t readCount_;
|
||||
size_t count_;
|
||||
bool eof_;
|
||||
int bzerror_;
|
||||
};
|
||||
|
||||
|
||||
inline FileReadGzStream::Ch FileReadGzStream::Peek () const { return *current_; }
|
||||
inline FileReadGzStream::Ch FileReadGzStream::Take () { Ch c = *current_; Read(); return c; }
|
||||
inline size_t FileReadGzStream::Tell () const { return count_ + static_cast<size_t>(current_ - buffer_); }
|
||||
inline void FileReadGzStream::Put ( Ch ) { assert(false); }
|
||||
inline void FileReadGzStream::Flush () { assert(false); }
|
||||
inline FileReadGzStream::Ch* FileReadGzStream::PutBegin () { assert(false); return 0; }
|
||||
inline size_t FileReadGzStream::PutEnd ( Ch* ) { assert(false); return 0; }
|
||||
inline const FileReadGzStream::Ch* FileReadGzStream::Peek4 () const { return (current_ + 4 <= bufferLast_) ? current_ : 0; }
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_FILEREADGZSTREAM_H
|
|
@ -0,0 +1,100 @@
|
|||
// -*- mode: C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC 2016-2015, 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/FileWriteGzStream.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_FILEWRITEGZSTREAM_H
|
||||
#define HURRICANE_FILEWRITEGZSTREAM_H
|
||||
|
||||
#include "rapidjson/rapidjson.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
typedef void BZFILE; // Must be identical to the typedef in <bzlib.h>.
|
||||
|
||||
|
||||
class FileWriteGzStream {
|
||||
public:
|
||||
typedef char Ch;
|
||||
public:
|
||||
FileWriteGzStream ( std::FILE* fp, char* buffer, size_t bufferSize );
|
||||
~FileWriteGzStream ();
|
||||
inline void Put ( char c );
|
||||
inline void PutN ( char c, size_t n );
|
||||
void Flush ();
|
||||
inline char Peek () const;
|
||||
inline char Take ();
|
||||
inline size_t Tell () const;
|
||||
inline char* PutBegin ();
|
||||
inline size_t PutEnd ( char* );
|
||||
private:
|
||||
FileWriteGzStream ( const FileWriteGzStream& );
|
||||
FileWriteGzStream& operator= ( const FileWriteGzStream& );
|
||||
private:
|
||||
std::FILE* fp_;
|
||||
BZFILE* bzfp_;
|
||||
char* buffer_;
|
||||
char* bufferEnd_;
|
||||
char* current_;
|
||||
int bzerror_;
|
||||
};
|
||||
|
||||
|
||||
inline void FileWriteGzStream::Put ( char c )
|
||||
{
|
||||
if (current_ >= bufferEnd_) Flush();
|
||||
*current_++ = c;
|
||||
}
|
||||
|
||||
|
||||
inline void FileWriteGzStream::PutN ( char c, size_t n )
|
||||
{
|
||||
size_t avail = static_cast<size_t>( bufferEnd_ - current_ );
|
||||
while (n > avail) {
|
||||
std::memset( current_, c, avail );
|
||||
current_ += avail;
|
||||
Flush();
|
||||
n -= avail;
|
||||
avail = static_cast<size_t>( bufferEnd_ - current_ );
|
||||
}
|
||||
|
||||
if (n > 0) {
|
||||
std::memset( current_, c, n );
|
||||
current_ += n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Not implemented
|
||||
inline char FileWriteGzStream::Peek () const { assert(false); return 0; }
|
||||
inline char FileWriteGzStream::Take () { assert(false); return 0; }
|
||||
inline size_t FileWriteGzStream::Tell () const { assert(false); return 0; }
|
||||
inline char* FileWriteGzStream::PutBegin () { assert(false); return 0; }
|
||||
inline size_t FileWriteGzStream::PutEnd ( char* ) { assert(false); return 0; }
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
namespace rapidjson {
|
||||
|
||||
|
||||
template<>
|
||||
inline void PutN ( Hurricane::FileWriteGzStream& stream, char c, size_t n ) { stream.PutN(c,n); }
|
||||
|
||||
|
||||
} // rapidjson namespace.
|
||||
|
||||
#endif // HURRICANE_FILEWRITEGZSTREAM_H
|
|
@ -116,6 +116,7 @@ class Horizontal : public Segment {
|
|||
class JsonHorizontal : public JsonSegment {
|
||||
// ****************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonHorizontal(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonHorizontal* clone(unsigned long) const;
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2015-2015, 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 |
|
||||
// | |
|
||||
// | Authors : Jean-Paul Chaput |
|
||||
// | E-mail : Jean-Paul.Chaput@lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./hurricane/Initializer.h" |
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef HURRICANE_INITIALIZER_H
|
||||
#define HURRICANE_INITIALIZER_H
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Init".
|
||||
|
||||
class Init {
|
||||
public:
|
||||
typedef std::function<void(void)> initializer_t;
|
||||
typedef std::multimap<unsigned int,initializer_t> InitializerMap;
|
||||
public:
|
||||
static void destroy ();
|
||||
static InitializerMap& initializers ();
|
||||
static void addInitializer ( unsigned int order, initializer_t );
|
||||
static bool runOnce ();
|
||||
private:
|
||||
static bool _run;
|
||||
static InitializerMap* _initializers;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Initializer".
|
||||
|
||||
template<typename T>
|
||||
class Initializer {
|
||||
public:
|
||||
inline Initializer ( unsigned int order ) { Init::addInitializer( order, T::initialize ); }
|
||||
};
|
||||
|
||||
|
||||
} // Hurricane namespace.
|
||||
|
||||
#endif // HURRICANE_INITIALIZER_H
|
|
@ -197,6 +197,7 @@ class Instance : public Go {
|
|||
class JsonInstance : public JsonEntity {
|
||||
// *************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonInstance(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonInstance* clone(unsigned long) const;
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#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>
|
||||
|
@ -45,6 +49,7 @@
|
|||
|
||||
namespace Hurricane {
|
||||
|
||||
class DBo;
|
||||
class Hook;
|
||||
class Entity;
|
||||
class Cell;
|
||||
|
@ -86,7 +91,7 @@ namespace Hurricane {
|
|||
virtual bool isDummy () const;
|
||||
virtual std::string getTypeName () const = 0;
|
||||
inline std::string getStackName () const;
|
||||
bool check ( JsonStack&, string fname ) 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 );
|
||||
|
@ -95,12 +100,11 @@ namespace Hurricane {
|
|||
inline void copyAttrs ( const JsonObject*, bool reset=false );
|
||||
inline void clear ();
|
||||
inline std::string getName () const;
|
||||
inline void setName ( const string& );
|
||||
inline void setName ( const std::string& );
|
||||
template<typename T> inline T& getObject () const;
|
||||
template<typename T> inline void setObject ( T& ) ;
|
||||
template<typename T> inline void setObject ( T ) ;
|
||||
inline bool isBound () const;
|
||||
virtual JsonObject* clone ( unsigned long flags ) const = 0;
|
||||
template<typename C> void toJson ( JsonWriter*, C* object ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
unsigned int presetId ( JsonStack& );
|
||||
template<typename T> inline void update ( JsonStack&, T );
|
||||
|
@ -130,7 +134,7 @@ namespace Hurricane {
|
|||
template<typename T> inline T& JsonObject::getObject () const
|
||||
{ return boost::any_cast<T>(_object); }
|
||||
|
||||
template<typename T> inline void JsonObject::setObject ( T& t )
|
||||
template<typename T> inline void JsonObject::setObject ( T t )
|
||||
{ _object = t; }
|
||||
|
||||
inline void JsonObject::copyAttrs ( const JsonObject* other, bool reset )
|
||||
|
@ -294,6 +298,9 @@ namespace Hurricane {
|
|||
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 );
|
||||
|
@ -309,18 +316,19 @@ namespace Hurricane {
|
|||
private:
|
||||
unsigned long _flags;
|
||||
vector<Element> _stack;
|
||||
vector<DBo*> _dbos;
|
||||
std::map<unsigned int,Entity*> _entities;
|
||||
HookLut _hooks;
|
||||
};
|
||||
|
||||
|
||||
inline JsonStack::JsonStack ()
|
||||
: _flags(0), _stack(), _entities(), _hooks()
|
||||
: _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() key:" << key << " value:" << 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)));
|
||||
}
|
||||
|
@ -333,7 +341,8 @@ namespace Hurricane {
|
|||
<< (count+1) << " elements remains to pop." << std::endl;
|
||||
break;
|
||||
}
|
||||
ltrace(51) << "| _stack.pop_back() " << _stack.back().first << endl;
|
||||
ltrace(51) << "| _stack.pop_back() \"" << _stack.back().first
|
||||
<< "\", size:" << _stack.size() << ", dbos:" << _dbos.size() << endl;
|
||||
_stack.pop_back();
|
||||
}
|
||||
}
|
||||
|
@ -395,6 +404,7 @@ namespace Hurricane {
|
|||
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);
|
||||
|
@ -402,6 +412,9 @@ namespace Hurricane {
|
|||
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; }
|
||||
|
@ -419,8 +432,10 @@ namespace Hurricane {
|
|||
return stack.as<T>( index );
|
||||
}
|
||||
|
||||
template<typename T> inline void JsonObject::update ( JsonStack& stack, T hobject )
|
||||
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 );
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace rapidjson {
|
|||
class FileWriteStream;
|
||||
}
|
||||
|
||||
namespace Hurricane {
|
||||
class FileWriteGzStream;
|
||||
}
|
||||
//namespace Hurricane {
|
||||
|
||||
|
||||
|
@ -55,6 +58,11 @@ namespace rapidjson {
|
|||
, DesignBlobMode = (1<<1)
|
||||
, CellMode = (1<<2)
|
||||
, RegisterMode = (1<<3)
|
||||
, RegisterStatus = (1<<4)
|
||||
, RegisterType = (1<<5)
|
||||
, UnregisterType = (1<<6)
|
||||
, CellObject = (1<<7)
|
||||
, DBoObject = (1<<8)
|
||||
};
|
||||
public:
|
||||
JsonWriter ( std::string fileName );
|
||||
|
@ -88,12 +96,13 @@ namespace rapidjson {
|
|||
JsonWriter ( const JsonWriter& );
|
||||
JsonWriter& operator= ( const JsonWriter& ) const;
|
||||
private:
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
rapidjson::FileWriteStream* _stream;
|
||||
void* _writer;
|
||||
unsigned long _flags;
|
||||
size_t _bufferSize;
|
||||
char* _buffer;
|
||||
FILE* _file;
|
||||
//rapidjson::FileWriteStream* _stream;
|
||||
Hurricane::FileWriteGzStream* _stream;
|
||||
void* _writer;
|
||||
};
|
||||
|
||||
|
||||
|
@ -172,6 +181,15 @@ inline void jsonWrite ( JsonWriter* w, const std::string& key, const std::strin
|
|||
{ 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());
|
||||
w->write( message.c_str() );
|
||||
}
|
||||
|
||||
|
||||
template<typename C>
|
||||
inline void jsonWrite ( JsonWriter* w, const C* object )
|
||||
{
|
||||
|
@ -187,6 +205,13 @@ inline void jsonWrite ( JsonWriter* w, const C* object )
|
|||
}
|
||||
|
||||
|
||||
template<typename C>
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, C* object )
|
||||
{
|
||||
jsonWrite( w, key, const_cast<const C*>(object) );
|
||||
}
|
||||
|
||||
|
||||
template<typename C>
|
||||
inline void jsonWrite ( JsonWriter* w, const std::string& key, const C* object )
|
||||
{
|
||||
|
|
|
@ -129,6 +129,7 @@ class Library : public DBo {
|
|||
class JsonLibrary : public JsonDBo {
|
||||
// *******************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonLibrary(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonLibrary* clone(unsigned long) const;
|
||||
|
|
|
@ -262,6 +262,7 @@ 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;
|
||||
|
|
|
@ -46,8 +46,9 @@ namespace Hurricane {
|
|||
, MixedPreRoute = Fixed|ManualGlobalRoute
|
||||
};
|
||||
public:
|
||||
inline bool isUnconnected () const;
|
||||
inline bool isExcluded () const;
|
||||
inline bool isFixed () const;
|
||||
inline bool isUnconnected () const;
|
||||
inline bool isManualGlobalRoute () const;
|
||||
inline bool isAutomaticGlobalRoute () const;
|
||||
inline bool isMixedPreRoute () const;
|
||||
|
@ -69,8 +70,9 @@ namespace Hurricane {
|
|||
|
||||
inline NetRoutingState::NetRoutingState ( Net* net, unsigned int flags ) : _net(net), _flags(flags) { }
|
||||
|
||||
inline bool NetRoutingState::isUnconnected () const { return _flags & Unconnected; };
|
||||
inline bool NetRoutingState::isExcluded () const { return _flags & Excluded; };
|
||||
inline bool NetRoutingState::isFixed () const { return _flags & Fixed; };
|
||||
inline bool NetRoutingState::isUnconnected () const { return _flags & Unconnected; };
|
||||
inline bool NetRoutingState::isManualGlobalRoute () const { return _flags & ManualGlobalRoute; };
|
||||
inline bool NetRoutingState::isAutomaticGlobalRoute () const { return _flags & AutomaticGlobalRoute; };
|
||||
inline bool NetRoutingState::isMixedPreRoute () const { return _flags & MixedPreRoute; };
|
||||
|
@ -94,6 +96,8 @@ namespace Hurricane {
|
|||
virtual Name getName () const;
|
||||
inline NetRoutingState* getState ();
|
||||
virtual void onReleasedBy ( DBo* owner );
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter*, const DBo* ) const;
|
||||
virtual std::string _getTypeName () const;
|
||||
virtual std::string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
@ -111,6 +115,19 @@ namespace Hurricane {
|
|||
inline NetRoutingState* NetRoutingProperty::getState () { return &_state; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::JsonNetRoutingProperty".
|
||||
|
||||
class JsonNetRoutingProperty : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonNetRoutingProperty ( unsigned long );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonNetRoutingProperty* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::NetRoutingExtension".
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ class Occurrence {
|
|||
class JsonOccurrence : public JsonObject {
|
||||
// **********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonOccurrence(unsigned long);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonOccurrence* clone(unsigned long) const;
|
||||
|
|
|
@ -85,6 +85,7 @@ class Pad : public Component {
|
|||
class JsonPad : public JsonComponent {
|
||||
// ***********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonPad(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonPad* clone(unsigned long) const;
|
||||
|
|
|
@ -118,6 +118,7 @@ class Plug : public Component {
|
|||
class JsonPlug : public JsonComponent {
|
||||
// ************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonPlug(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonPlug* clone(unsigned long) const;
|
||||
|
@ -128,6 +129,7 @@ class JsonPlug : public JsonComponent {
|
|||
class JsonPlugRef : public JsonObject {
|
||||
// ************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonPlugRef(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonPlugRef* clone(unsigned long) const;
|
||||
|
|
|
@ -90,6 +90,7 @@ class Point {
|
|||
class JsonPoint : public JsonObject {
|
||||
// **********************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonPoint(unsigned long);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonPoint* clone(unsigned long) const;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// Copyright (c) BULL S.A. 2000-2015, 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/Property.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
// +-----------------------------------------------------------------+
|
||||
|
||||
|
||||
#ifndef __HURRICANE_PROPERTY__
|
||||
#define __HURRICANE_PROPERTY__
|
||||
#ifndef HURRICANE_PROPERTY_H
|
||||
#define HURRICANE_PROPERTY_H
|
||||
|
||||
#include "hurricane/Name.h"
|
||||
#include "hurricane/Properties.h"
|
||||
|
@ -53,6 +44,13 @@ namespace Hurricane {
|
|||
extern const char* propertyTypeNameError;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Classes : template enable/disable Json support.
|
||||
|
||||
struct JsonEnabled { enum State { enabled=1 }; };
|
||||
struct JsonDisabled { enum State { enabled=0 }; };
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "Hurricane::Property".
|
||||
|
||||
|
@ -76,6 +74,8 @@ namespace Hurricane {
|
|||
virtual void onCapturedBy ( DBo* owner ) = 0;
|
||||
virtual void onReleasedBy ( DBo* owner ) = 0;
|
||||
// Hurricane Managment.
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter*, const DBo* ) const;
|
||||
virtual string _getTypeName () const = 0;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
@ -160,8 +160,8 @@ namespace Hurricane {
|
|||
// Template Class : "Hurricane::StandardPrivateProperty".
|
||||
|
||||
|
||||
template<typename Value> class StandardPrivateProperty : public PrivateProperty {
|
||||
|
||||
template<typename Value, typename JsonState=JsonDisabled>
|
||||
class StandardPrivateProperty : public PrivateProperty {
|
||||
public:
|
||||
static Name staticGetName ();
|
||||
static Value* staticGetValue ( const DBo* );
|
||||
|
@ -173,49 +173,99 @@ namespace Hurricane {
|
|||
virtual Name getName () const;
|
||||
Value& getValue () const;
|
||||
void setValue ( const Value& );
|
||||
virtual bool hasJson () const;
|
||||
virtual void toJson ( JsonWriter*, const DBo* ) const;
|
||||
virtual string _getTypeName () const;
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
||||
private:
|
||||
// Internal: Attributes.
|
||||
static Name _name;
|
||||
static DBo* _owner;
|
||||
static StandardPrivateProperty* _cache;
|
||||
mutable Value _value;
|
||||
|
||||
protected:
|
||||
// Internal: Constructor.
|
||||
StandardPrivateProperty ();
|
||||
StandardPrivateProperty ( const Value& );
|
||||
public:
|
||||
class JsonProperty : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonProperty ( unsigned long flags );
|
||||
virtual string getTypeName () const;
|
||||
virtual JsonProperty* clone ( unsigned long ) const;
|
||||
virtual void toData ( JsonStack& );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<typename Value>
|
||||
DBo* StandardPrivateProperty<Value>::_owner = NULL;
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>::JsonProperty::JsonProperty ( unsigned long flags )
|
||||
: JsonObject(flags)
|
||||
{
|
||||
if (flags & JsonWriter::RegisterMode)
|
||||
cerr << "Registering JsonProperty" << endl;
|
||||
add( "_value", typeid(Value) );
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::_cache = NULL;
|
||||
template<typename Value, typename JsonState>
|
||||
string StandardPrivateProperty<Value,JsonState>::JsonProperty::getTypeName () const
|
||||
{ return getString(StandardPrivateProperty<Value,JsonState>::staticGetName()); }
|
||||
|
||||
|
||||
template<typename Value>
|
||||
Name StandardPrivateProperty<Value>::staticGetName ()
|
||||
template<typename Value, typename JsonState>
|
||||
void StandardPrivateProperty<Value,JsonState>::JsonProperty::initialize ()
|
||||
{ JsonTypes::registerType( new JsonProperty (JsonWriter::RegisterMode) ); }
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
typename StandardPrivateProperty<Value,JsonState>::JsonProperty*
|
||||
StandardPrivateProperty<Value,JsonState>::JsonProperty::clone ( unsigned long flags ) const
|
||||
{ return new JsonProperty ( flags ); }
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
void StandardPrivateProperty<Value,JsonState>::JsonProperty::toData ( JsonStack& stack )
|
||||
{
|
||||
check( stack, "JsonProperty::toData" );
|
||||
|
||||
DBo* dbo = stack.back_dbo();
|
||||
Value value = get<string>(stack,"_value");
|
||||
StandardPrivateProperty<Value,JsonState>* property
|
||||
= StandardPrivateProperty<Value,JsonState>::create(value);
|
||||
if (dbo) dbo->put( property );
|
||||
|
||||
update( stack, property );
|
||||
}
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
DBo* StandardPrivateProperty<Value,JsonState>::_owner = NULL;
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>* StandardPrivateProperty<Value,JsonState>::_cache = NULL;
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
Name StandardPrivateProperty<Value,JsonState>::staticGetName ()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
Value* StandardPrivateProperty<Value>::staticGetValue ( const DBo* object )
|
||||
template<typename Value, typename JsonState>
|
||||
Value* StandardPrivateProperty<Value,JsonState>::staticGetValue ( const DBo* object )
|
||||
{
|
||||
if ( ( object == _owner ) || get(object) ) return _cache->getValue();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ()
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>* StandardPrivateProperty<Value,JsonState>::create ()
|
||||
{
|
||||
_cache = new StandardPrivateProperty<Value>();
|
||||
_cache->_postCreate();
|
||||
|
@ -223,8 +273,8 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ( const Value& value )
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>* StandardPrivateProperty<Value,JsonState>::create ( const Value& value )
|
||||
{
|
||||
_cache = new StandardPrivateProperty<Value>(value);
|
||||
_cache->_postCreate();
|
||||
|
@ -232,8 +282,8 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::get ( const DBo* object, bool create )
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>* StandardPrivateProperty<Value,JsonState>::get ( const DBo* object, bool create )
|
||||
{
|
||||
if ( object == _owner ) return _cache;
|
||||
|
||||
|
@ -253,60 +303,79 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>::StandardPrivateProperty ()
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>::StandardPrivateProperty ()
|
||||
: PrivateProperty(), _value()
|
||||
{ }
|
||||
|
||||
|
||||
template<typename Value>
|
||||
StandardPrivateProperty<Value>::StandardPrivateProperty ( const Value& value )
|
||||
template<typename Value, typename JsonState>
|
||||
StandardPrivateProperty<Value,JsonState>::StandardPrivateProperty ( const Value& value )
|
||||
: PrivateProperty(), _value(value)
|
||||
{ }
|
||||
|
||||
|
||||
template<typename Value>
|
||||
Name StandardPrivateProperty<Value>::getName() const
|
||||
template<typename Value, typename JsonState>
|
||||
Name StandardPrivateProperty<Value,JsonState>::getName() const
|
||||
{
|
||||
return staticGetName();
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
Value& StandardPrivateProperty<Value>::getValue () const
|
||||
template<typename Value, typename JsonState>
|
||||
Value& StandardPrivateProperty<Value,JsonState>::getValue () const
|
||||
{
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
void StandardPrivateProperty<Value>::setValue ( const Value& value )
|
||||
template<typename Value, typename JsonState>
|
||||
void StandardPrivateProperty<Value,JsonState>::setValue ( const Value& value )
|
||||
{
|
||||
_value = value;
|
||||
}
|
||||
|
||||
|
||||
template<typename Value>
|
||||
string StandardPrivateProperty<Value>::_getTypeName () const
|
||||
template<typename Value, typename JsonState>
|
||||
bool StandardPrivateProperty<Value,JsonState>::hasJson () const
|
||||
{
|
||||
return JsonState::enabled;
|
||||
}
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
void StandardPrivateProperty<Value,JsonState>::toJson ( JsonWriter* w, const DBo* ) const
|
||||
{
|
||||
w->startObject();
|
||||
std::string tname = getString(staticGetName());
|
||||
jsonWrite( w, "@typename", tname );
|
||||
jsonWrite( w, "_value", _value );
|
||||
w->endObject();
|
||||
}
|
||||
|
||||
|
||||
template<typename Value, typename JsonState>
|
||||
string StandardPrivateProperty<Value,JsonState>::_getTypeName () const
|
||||
{
|
||||
return _TName("StandardPrivateProperty");
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
string StandardPrivateProperty<Value>::_getString () const
|
||||
template<typename Value, typename JsonState>
|
||||
string StandardPrivateProperty<Value,JsonState>::_getString () const
|
||||
{
|
||||
string s = PrivateProperty::_getString();
|
||||
s.insert(s.length() - 1, " " + getString(_value));
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Record* StandardPrivateProperty<Value>::_getRecord () const
|
||||
template<typename Value, typename JsonState>
|
||||
Record* StandardPrivateProperty<Value,JsonState>::_getRecord () const
|
||||
{
|
||||
Record* record = PrivateProperty::_getRecord();
|
||||
if (record) {
|
||||
record->add ( getSlot("Name" , staticGetName()) );
|
||||
record->add ( getSlot("Value",&_value) );
|
||||
record->add ( getSlot("_name" , staticGetName()) );
|
||||
record->add ( getSlot("_value" ,&_value) );
|
||||
record->add ( getSlot("JSON support", JsonState::enabled) );
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
@ -317,33 +386,51 @@ namespace Hurricane {
|
|||
|
||||
|
||||
class SharedProperty : public Property {
|
||||
|
||||
public:
|
||||
// Types.
|
||||
typedef set<DBo*> DBoSet;
|
||||
// Methods.
|
||||
inline DBos getOwners () const;
|
||||
virtual void onCapturedBy ( DBo* owner );
|
||||
virtual void onReleasedBy ( DBo* owner );
|
||||
virtual void onNotOwned ();
|
||||
inline DBoSet& _getOwnerSet ();
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
|
||||
private:
|
||||
// Internal: Attributes.
|
||||
DBoSet _ownerSet;
|
||||
|
||||
class Orphaned {
|
||||
public:
|
||||
inline Orphaned ( SharedProperty* );
|
||||
public:
|
||||
SharedProperty* _property;
|
||||
unsigned int _refcount;
|
||||
unsigned int _count;
|
||||
};
|
||||
public:
|
||||
typedef set<DBo*> DBoSet;
|
||||
typedef map<string,Orphaned> OrphanedMap;
|
||||
public:
|
||||
static const OrphanedMap& getOrphaneds ();
|
||||
static SharedProperty* getOrphaned ( const string& );
|
||||
static void addOrphaned ( const string&, SharedProperty* );
|
||||
static void refOrphaned ( const string& );
|
||||
static void countOrphaned ( const string&, unsigned int );
|
||||
static void removeOrphaned ( const string& );
|
||||
static void clearOrphaneds ();
|
||||
public:
|
||||
inline DBos getOwners () const;
|
||||
virtual void onCapturedBy ( DBo* owner );
|
||||
virtual void onReleasedBy ( DBo* owner );
|
||||
virtual void onNotOwned ();
|
||||
inline DBoSet& _getOwnerSet ();
|
||||
virtual string _getString () const;
|
||||
virtual Record* _getRecord () const;
|
||||
private:
|
||||
static OrphanedMap _orphaneds;
|
||||
private:
|
||||
DBoSet _ownerSet;
|
||||
protected:
|
||||
// Internal: Constructor & Destructor.
|
||||
SharedProperty ();
|
||||
virtual void _preDestroy ();
|
||||
};
|
||||
|
||||
|
||||
// Inline Functions.
|
||||
DBos SharedProperty::getOwners () const { return getCollection(_ownerSet); }
|
||||
SharedProperty::DBoSet& SharedProperty::_getOwnerSet () { return _ownerSet; }
|
||||
inline SharedProperty::Orphaned::Orphaned ( SharedProperty* property )
|
||||
: _property(property), _refcount(0), _count(0)
|
||||
{ }
|
||||
|
||||
inline DBos SharedProperty::getOwners () const { return getCollection(_ownerSet); }
|
||||
inline SharedProperty::DBoSet& SharedProperty::_getOwnerSet () { return _ownerSet; }
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -505,10 +592,10 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
} // Hurricane namespace.
|
||||
|
||||
|
||||
INSPECTOR_P_SUPPORT(Hurricane::Property);
|
||||
|
||||
|
||||
#endif // __HURRICANE_PROPERTY__
|
||||
#endif // HURRICANE_PROPERTY_H
|
||||
|
|
|
@ -62,6 +62,7 @@ class Relation : public SharedProperty {
|
|||
// Others
|
||||
// ******
|
||||
|
||||
public: void _setMasterOwner(DBo* owner) {_masterOwner=owner; }
|
||||
protected: virtual void _postCreate();
|
||||
|
||||
public: virtual string _getTypeName() const {return _TName("Relation");};
|
||||
|
|
|
@ -103,6 +103,7 @@ namespace Hurricane {
|
|||
|
||||
class JsonRoutingPad : public JsonComponent {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonRoutingPad ( unsigned long flags );
|
||||
virtual std::string getTypeName () const;
|
||||
virtual JsonRoutingPad* clone ( unsigned long flags ) const;
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace Hurricane {
|
|||
|
||||
class JsonSignature : public JsonObject {
|
||||
public:
|
||||
static void initialize ();
|
||||
JsonSignature ( unsigned long flags );
|
||||
void setSubType ( const std::string& );
|
||||
virtual std::string getTypeName () const;
|
||||
|
|
|
@ -142,6 +142,7 @@ class Transformation {
|
|||
class JsonTransformation : public JsonObject {
|
||||
// *******************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonTransformation(unsigned long);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonTransformation* clone(unsigned long) const;
|
||||
|
|
|
@ -117,6 +117,7 @@ class Vertical : public Segment {
|
|||
class JsonVertical : public JsonSegment {
|
||||
// **************************************
|
||||
|
||||
public: static void initialize();
|
||||
public: JsonVertical(unsigned long flags);
|
||||
public: virtual string getTypeName() const;
|
||||
public: virtual JsonVertical* clone(unsigned long) const;
|
||||
|
|
|
@ -732,6 +732,7 @@ namespace Hurricane {
|
|||
DebugSession::close();
|
||||
|
||||
setCell ( topCell );
|
||||
emit cellLoadedFromDisk( topCell );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,14 +742,14 @@ namespace Hurricane {
|
|||
Cell* cell = getCell();
|
||||
if (not cell) return;
|
||||
|
||||
string blobName = getString(cell->getName()) + ".blob.json";
|
||||
string blobName = getString(cell->getName()) + ".blob.json.bz2";
|
||||
DesignBlob blob ( cell );
|
||||
|
||||
DebugSession::open( 50 );
|
||||
//DebugSession::open( 50 );
|
||||
JsonWriter writer ( blobName );
|
||||
writer.setFlags( JsonWriter::DesignBlobMode );
|
||||
jsonWrite( &writer, &blob );
|
||||
DebugSession::close();
|
||||
//DebugSession::close();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Hurricane {
|
|||
setWindowTitle( tr("Open Design Blob") );
|
||||
|
||||
QLabel* label = new QLabel ();
|
||||
label->setText( tr("Enter the Blob name (without extention \".blob.json\")") );
|
||||
label->setText( tr("Enter the Blob name (without extention \".blob.json.bz2\")") );
|
||||
label->setFont( Graphics::getNormalFont(true) );
|
||||
|
||||
_lineEdit = new QLineEdit ();
|
||||
|
|
|
@ -150,6 +150,7 @@ namespace Hurricane {
|
|||
inline void emitCellPreModificated ();
|
||||
inline void emitCellPostModificated ();
|
||||
signals:
|
||||
void cellLoadedFromDisk ( Cell* );
|
||||
void showSelectionToggled ( bool );
|
||||
void stateChanged ( shared_ptr<CellWidget::State>& );
|
||||
void redrawCellWidget ();
|
||||
|
|
|
@ -182,6 +182,7 @@ namespace Unicorn {
|
|||
, QKeySequence(tr("CTRL+M"))
|
||||
);
|
||||
connect( action, SIGNAL(triggered()), _libraryManager, SLOT(toggleShow()) );
|
||||
connect( this , SIGNAL(cellLoadedFromDisk(Cell*)), _libraryManager, SLOT(updateLibrary(Cell*)) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,6 +239,7 @@ namespace Unicorn {
|
|||
viewer->show ();
|
||||
}
|
||||
viewer->setCell ( cell );
|
||||
emit cellLoadedFromDisk ( cell );
|
||||
} else
|
||||
cerr << "[ERROR] Cell not found: " << cellName.toStdString() << endl;
|
||||
}
|
||||
|
@ -260,6 +262,7 @@ namespace Unicorn {
|
|||
viewer->show();
|
||||
}
|
||||
viewer->setCell( cell );
|
||||
emit cellLoadedFromDisk ( cell );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,10 +294,10 @@ namespace Unicorn {
|
|||
}
|
||||
break;
|
||||
case ExportCellDialog::Json:
|
||||
{ DebugSession::open( 50 );
|
||||
JsonWriter writer ( cellName.toStdString()+".json" );
|
||||
{ //DebugSession::open( 50 );
|
||||
JsonWriter writer ( cellName.toStdString()+".json.bz2" );
|
||||
jsonWrite( &writer, cell );
|
||||
DebugSession::close();
|
||||
//DebugSession::close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue