From 5baddeb558e9376219ed831c0265106c2d282470 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Thu, 21 Jan 2016 00:25:39 +0100 Subject: [PATCH] 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. --- Makefile | 4 +- README.rst | 5 +- bootstrap/build.conf | 7 +- bootstrap/builder/Builder.py | 12 +- crlcore/etc/cmos/alliance.conf | 1 + crlcore/src/LibraryManager/CellsModel.cpp | 2 + crlcore/src/LibraryManager/CellsWidget.cpp | 4 + crlcore/src/LibraryManager/LibraryManager.cpp | 3 + .../src/LibraryManager/crlcore/CellsModel.h | 4 +- .../src/LibraryManager/crlcore/CellsWidget.h | 1 + .../LibraryManager/crlcore/LibraryManager.h | 3 +- crlcore/src/ccore/AllianceFramework.cpp | 154 +++++++++-- crlcore/src/ccore/AllianceLibrary.cpp | 156 ++++++++---- crlcore/src/ccore/Catalog.cpp | 158 +++++++++++- crlcore/src/ccore/Environment.cpp | 86 +++++++ crlcore/src/ccore/crlcore/AllianceFramework.h | 41 ++- crlcore/src/ccore/crlcore/AllianceLibrary.h | 17 +- crlcore/src/ccore/crlcore/Catalog.h | 34 ++- crlcore/src/ccore/crlcore/Environment.h | 23 +- documentation/UsersGuide/UsersGuide.html | 228 +++++++++-------- documentation/UsersGuide/UsersGuide.pdf | Bin 562761 -> 1546296 bytes documentation/UsersGuide/UsersGuide.rst | 37 ++- etesian/src/EtesianEngine.cpp | 1 + hurricane/CMakeLists.txt | 1 + hurricane/doc/hurricane/Initializer.dox | 29 +++ hurricane/doc/hurricane/JsonObject.dox | 198 ++++++++++++++ hurricane/doc/hurricane/JsonSupport.dox | 241 ++++++++++++++++++ .../doc/hurricane/StandardSharedProperty.dox | 3 - hurricane/doc/hurricane/doxyfile | 5 + hurricane/src/hurricane/Box.cpp | 9 +- hurricane/src/hurricane/CMakeLists.txt | 9 +- hurricane/src/hurricane/Cell.cpp | 197 +++++++++++++- hurricane/src/hurricane/Contact.cpp | 7 + hurricane/src/hurricane/DBo.cpp | 8 +- hurricane/src/hurricane/DataBase.cpp | 195 ++++++++++++-- hurricane/src/hurricane/DeepNet.cpp | 6 + hurricane/src/hurricane/DesignBlob.cpp | 19 +- hurricane/src/hurricane/FileReadGzStream.cpp | 83 ++++++ hurricane/src/hurricane/FileWriteGzStream.cpp | 79 ++++++ hurricane/src/hurricane/Horizontal.cpp | 7 + hurricane/src/hurricane/Initializer.cpp | 78 ++++++ hurricane/src/hurricane/Instance.cpp | 11 +- hurricane/src/hurricane/JsonReader.cpp | 88 +++---- hurricane/src/hurricane/JsonWriter.cpp | 9 +- hurricane/src/hurricane/Library.cpp | 23 +- hurricane/src/hurricane/Net.cpp | 18 +- .../src/hurricane/NetRoutingProperty.cpp | 98 ++++++- hurricane/src/hurricane/Occurrence.cpp | 32 ++- hurricane/src/hurricane/Pad.cpp | 7 + hurricane/src/hurricane/Plug.cpp | 13 + hurricane/src/hurricane/Point.cpp | 7 + hurricane/src/hurricane/Property.cpp | 78 +++++- hurricane/src/hurricane/RoutingPad.cpp | 7 + hurricane/src/hurricane/Signature.cpp | 7 + hurricane/src/hurricane/Transformation.cpp | 8 +- hurricane/src/hurricane/UpdateSession.cpp | 18 +- hurricane/src/hurricane/Vertical.cpp | 7 + hurricane/src/hurricane/hurricane/Box.h | 1 + hurricane/src/hurricane/hurricane/Cell.h | 31 ++- hurricane/src/hurricane/hurricane/Commons.h | 1 + hurricane/src/hurricane/hurricane/Contact.h | 1 + hurricane/src/hurricane/hurricane/DBo.h | 12 +- hurricane/src/hurricane/hurricane/DataBase.h | 26 +- hurricane/src/hurricane/hurricane/DeepNet.h | 1 + .../src/hurricane/hurricane/DesignBlob.h | 1 + hurricane/src/hurricane/hurricane/Entity.h | 4 +- .../hurricane/hurricane/FileReadGzStream.h | 73 ++++++ .../hurricane/hurricane/FileWriteGzStream.h | 100 ++++++++ .../src/hurricane/hurricane/Horizontal.h | 1 + .../src/hurricane/hurricane/Initializer.h | 72 ++++++ hurricane/src/hurricane/hurricane/Instance.h | 1 + .../src/hurricane/hurricane/JsonReader.h | 33 ++- .../src/hurricane/hurricane/JsonWriter.h | 37 ++- hurricane/src/hurricane/hurricane/Library.h | 1 + hurricane/src/hurricane/hurricane/Net.h | 1 + .../hurricane/hurricane/NetRoutingProperty.h | 21 +- .../src/hurricane/hurricane/Occurrence.h | 1 + hurricane/src/hurricane/hurricane/Pad.h | 1 + hurricane/src/hurricane/hurricane/Plug.h | 2 + hurricane/src/hurricane/hurricane/Point.h | 1 + hurricane/src/hurricane/hurricane/Property.h | 227 ++++++++++++----- hurricane/src/hurricane/hurricane/Relation.h | 1 + .../src/hurricane/hurricane/RoutingPad.h | 1 + hurricane/src/hurricane/hurricane/Signature.h | 1 + .../src/hurricane/hurricane/Transformation.h | 1 + hurricane/src/hurricane/hurricane/Vertical.h | 1 + hurricane/src/viewer/CellViewer.cpp | 7 +- hurricane/src/viewer/OpenBlobDialog.cpp | 2 +- .../src/viewer/hurricane/viewer/CellViewer.h | 1 + unicorn/src/UnicornGui.cpp | 9 +- 90 files changed, 2813 insertions(+), 447 deletions(-) create mode 100644 hurricane/doc/hurricane/Initializer.dox create mode 100644 hurricane/doc/hurricane/JsonObject.dox create mode 100644 hurricane/doc/hurricane/JsonSupport.dox create mode 100644 hurricane/src/hurricane/FileReadGzStream.cpp create mode 100644 hurricane/src/hurricane/FileWriteGzStream.cpp create mode 100644 hurricane/src/hurricane/Initializer.cpp create mode 100644 hurricane/src/hurricane/hurricane/FileReadGzStream.h create mode 100644 hurricane/src/hurricane/hurricane/FileWriteGzStream.h create mode 100644 hurricane/src/hurricane/hurricane/Initializer.h diff --git a/Makefile b/Makefile index 5f491ea1..92fbcec1 100644 --- a/Makefile +++ b/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"; \ diff --git a/README.rst b/README.rst index 91cef49b..3227ae9f 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/bootstrap/build.conf b/bootstrap/build.conf index 8447c0e8..388ae4c4 100644 --- a/bootstrap/build.conf +++ b/bootstrap/build.conf @@ -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" diff --git a/bootstrap/builder/Builder.py b/bootstrap/builder/Builder.py index fc8031c9..b2ff8c1b 100644 --- a/bootstrap/builder/Builder.py +++ b/bootstrap/builder/Builder.py @@ -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 ] diff --git a/crlcore/etc/cmos/alliance.conf b/crlcore/etc/cmos/alliance.conf index 05c99819..5e937d65 100644 --- a/crlcore/etc/cmos/alliance.conf +++ b/crlcore/etc/cmos/alliance.conf @@ -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) diff --git a/crlcore/src/LibraryManager/CellsModel.cpp b/crlcore/src/LibraryManager/CellsModel.cpp index 12410cb4..5e82a0fb 100644 --- a/crlcore/src/LibraryManager/CellsModel.cpp +++ b/crlcore/src/LibraryManager/CellsModel.cpp @@ -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 ); diff --git a/crlcore/src/LibraryManager/CellsWidget.cpp b/crlcore/src/LibraryManager/CellsWidget.cpp index b181039b..d95fef05 100644 --- a/crlcore/src/LibraryManager/CellsWidget.cpp +++ b/crlcore/src/LibraryManager/CellsWidget.cpp @@ -86,6 +86,10 @@ namespace CRL { } + void CellsWidget::updateLibrary () + { _baseModel->updateLibrary(); } + + void CellsWidget::updateSelected () { if (_selected.isValid()) _baseModel->emitDataChanged(_selected); } diff --git a/crlcore/src/LibraryManager/LibraryManager.cpp b/crlcore/src/LibraryManager/LibraryManager.cpp index e95c7cb0..a37c8e06 100644 --- a/crlcore/src/LibraryManager/LibraryManager.cpp +++ b/crlcore/src/LibraryManager/LibraryManager.cpp @@ -139,5 +139,8 @@ namespace CRL { } + void LibraryManager::updateLibrary ( Cell* ) + { _cellsWidget->updateLibrary(); } + } // CRL namespace. diff --git a/crlcore/src/LibraryManager/crlcore/CellsModel.h b/crlcore/src/LibraryManager/crlcore/CellsModel.h index 56324b3a..c8fe59c4 100644 --- a/crlcore/src/LibraryManager/crlcore/CellsModel.h +++ b/crlcore/src/LibraryManager/crlcore/CellsModel.h @@ -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& CellsModel::getCellsDatas () const { return _ilibrary->second; } inline std::vector& CellsModel::getCellsDatas () { return _ilibrary->second; } diff --git a/crlcore/src/LibraryManager/crlcore/CellsWidget.h b/crlcore/src/LibraryManager/crlcore/CellsWidget.h index 2719e236..243f9909 100644 --- a/crlcore/src/LibraryManager/crlcore/CellsWidget.h +++ b/crlcore/src/LibraryManager/crlcore/CellsWidget.h @@ -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: diff --git a/crlcore/src/LibraryManager/crlcore/LibraryManager.h b/crlcore/src/LibraryManager/crlcore/LibraryManager.h index 50cfbfc5..4dd2ec6b 100644 --- a/crlcore/src/LibraryManager/crlcore/LibraryManager.h +++ b/crlcore/src/LibraryManager/crlcore/LibraryManager.h @@ -50,10 +50,11 @@ namespace CRL { LibraryManager ( QWidget* parent=NULL ); inline void setCellViewer ( CellViewer* ); inline CellViewer* getCellViewer () const; - public slots: + public slots: void toggleShow (); void setLibrary ( const AllianceLibrary* library ); CellViewer* openCell ( Cell*, unsigned int flags ); + void updateLibrary ( Cell* ); private: LibrariesWidget* _librariesWidget; CellsWidget* _cellsWidget; diff --git a/crlcore/src/ccore/AllianceFramework.cpp b/crlcore/src/ccore/AllianceFramework.cpp index 01b83216..d11f8010 100644 --- a/crlcore/src/ccore/AllianceFramework.cpp +++ b/crlcore/src/ccore/AllianceFramework.cpp @@ -15,9 +15,10 @@ #include #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 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(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 ; igetLibrary()) ) 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 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. diff --git a/crlcore/src/ccore/AllianceLibrary.cpp b/crlcore/src/ccore/AllianceLibrary.cpp index 2e468d3f..7d5f3e8e 100644 --- a/crlcore/src/ccore/AllianceLibrary.cpp +++ b/crlcore/src/ccore/AllianceLibrary.cpp @@ -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 -// Sophie Belloeil -// Hugo Clément -// Jean-Paul Chaput -// Damien Dupuis -// Christian Masson -// Marek Sroka -// -// 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 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( stack,"_library" ); + string libOsPath = get( 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. diff --git a/crlcore/src/ccore/Catalog.cpp b/crlcore/src/ccore/Catalog.cpp index 8f691bd8..dae1542b 100644 --- a/crlcore/src/ccore/Catalog.cpp +++ b/crlcore/src/ccore/Catalog.cpp @@ -17,15 +17,25 @@ # include 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 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 ( stack, "_cell" ); + string sflags = get ( stack, "_flags" ); + unsigned int depth = get( 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 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( stack, "_state" ); + CatalogProperty* property = NULL; + + ltrace(51) << "topDBo:" << dbo << endl; + + Cell* cell = dynamic_cast( dbo ); + if (cell) { + Property* base = cell->getProperty( CatalogProperty::getPropertyName() ); + if (base) { + property = static_cast( 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" diff --git a/crlcore/src/ccore/Environment.cpp b/crlcore/src/ccore/Environment.cpp index 9bc6bcc6..016ad3ff 100644 --- a/crlcore/src/ccore/Environment.cpp +++ b/crlcore/src/ccore/Environment.cpp @@ -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 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 (stack,"_displayStyle").c_str() ); + environement->setSCALE_X ( get(stack,"_SCALE_X" ) ); + environement->setIN_LO ( get (stack,"_IN_LO" ).c_str() ); + environement->setIN_PH ( get (stack,"_IN_PH" ).c_str() ); + environement->setOUT_LO ( get (stack,"_OUT_LO" ).c_str() ); + environement->setOUT_PH ( get (stack,"_OUT_PH" ).c_str() ); + environement->setPOWER ( get (stack,"_POWER" ).c_str() ); + environement->setGROUND ( get (stack,"_GROUND" ).c_str() ); + environement->setCLOCK ( get (stack,"_CLOCK" ).c_str() ); + environement->setBLOCKAGE ( get (stack,"_BLOCKAGE" ).c_str() ); + environement->setPad ( get (stack,"_pad" ).c_str() ); + environement->setCATALOG ( get (stack,"_CATALOG" ).c_str() ); + + update( stack, environement ); + } + + } // End of CRL namespace. diff --git a/crlcore/src/ccore/crlcore/AllianceFramework.h b/crlcore/src/ccore/crlcore/AllianceFramework.h index e41b43f1..be5ca85f 100644 --- a/crlcore/src/ccore/crlcore/AllianceFramework.h +++ b/crlcore/src/ccore/crlcore/AllianceFramework.h @@ -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 -#include -#include "hurricane/Cell.h" -#include "crlcore/Environment.h" -#include "crlcore/AllianceLibrary.h" -#include "crlcore/Catalog.h" -#include "crlcore/ParsersDrivers.h" +#include +#include +#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. diff --git a/crlcore/src/ccore/crlcore/AllianceLibrary.h b/crlcore/src/ccore/crlcore/AllianceLibrary.h index 64e8cd70..2bce1864 100644 --- a/crlcore/src/ccore/crlcore/AllianceLibrary.h +++ b/crlcore/src/ccore/crlcore/AllianceLibrary.h @@ -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. diff --git a/crlcore/src/ccore/crlcore/Catalog.h b/crlcore/src/ccore/crlcore/Catalog.h index 0b272450..820c54a8 100644 --- a/crlcore/src/ccore/crlcore/Catalog.h +++ b/crlcore/src/ccore/crlcore/Catalog.h @@ -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; } diff --git a/crlcore/src/ccore/crlcore/Environment.h b/crlcore/src/ccore/crlcore/Environment.h index facceecd..0824bedf 100644 --- a/crlcore/src/ccore/crlcore/Environment.h +++ b/crlcore/src/ccore/crlcore/Environment.h @@ -19,11 +19,18 @@ #include #include -#include +#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. diff --git a/documentation/UsersGuide/UsersGuide.html b/documentation/UsersGuide/UsersGuide.html index affefcb6..de7cb191 100644 --- a/documentation/UsersGuide/UsersGuide.html +++ b/documentation/UsersGuide/UsersGuide.html @@ -41,79 +41,80 @@
  • Release 1.0.1963
  • Release 1.0.2049
  • Release v2.0.1
  • -
  • Release v2.1
  • +
  • Release v2.1
  • +
  • Release v2.2
  • -
  • Installation