* ./crlcore:
- Cleanup: No longer import the std namespace in headers. - Bug: In Measures.h, incoherent prototyping of getMeasure() template. - Change: In Environment, SearchPath & the XML format, slight change to allow overwriting of Alliance library pathes. Instead of having an attribute on the <system> node that applies to all libraries, we have a "mode" attribute in each <library> node. "mode" can takes three values: 1. - "append" : the library path is added in tail of the list. 2. - "prepend" : the library path is added in head of the list. 3. - "replace" : if the library already exists in the pathes, this ones replaces it, whitout modifiying the order. If it doesn't exists, it simply appended. The "replace" mode is the one to be used if a users wants to shadow system libraries by his own versions (sets in ~/.environment.alliance.xml).
This commit is contained in:
parent
57f3e4e107
commit
cd7a294ca9
|
@ -20,7 +20,7 @@
|
|||
<working>
|
||||
<library>.</library>
|
||||
</working>
|
||||
<system operation="append">
|
||||
<system>
|
||||
<library>${CELL_TOP}/cells/sxlib</library>
|
||||
<library>${CELL_TOP}/cells/dp_sxlib</library>
|
||||
<library>${CELL_TOP}/cells/ramlib</library>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -16,7 +16,7 @@
|
|||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./Environnment.h" |
|
||||
// | C++ Module : "./Environnment.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
|
@ -176,7 +176,7 @@ namespace {
|
|||
addTagEntry ( TagsLibraries , "catalog" , (tagParser_t)&XmlEnvironmentParser::parseCatalog );
|
||||
addTagEntry ( TagsLibraries , "working" , (tagParser_t)&XmlEnvironmentParser::parseWorking );
|
||||
addTagEntry ( TagsWorking , "library" , (tagParser_t)&XmlEnvironmentParser::parseLibrary );
|
||||
addTagEntry ( TagsLibraries , "system" , (tagParser_t)&XmlEnvironmentParser::parseSystem );
|
||||
addTagEntry ( TagsLibraries , "system" , (tagParser_t)&XmlEnvironmentParser::parseSystem );
|
||||
addTagEntry ( TagsSystem , "library" , (tagParser_t)&XmlEnvironmentParser::parseLibrary );
|
||||
|
||||
addTagEntry ( TagsEnvironment , "formats" , (tagParser_t)&XmlEnvironmentParser::parseFormats );
|
||||
|
@ -387,12 +387,12 @@ namespace {
|
|||
|
||||
QString operation;
|
||||
|
||||
operation = _reader->attributes().value("operation").toString();
|
||||
if ( operation.isEmpty() )
|
||||
_environment.getLIBRARIES().reset();
|
||||
else if ( operation != "append" )
|
||||
cerr << "[ERROR] Invalid value for attribute \"operation\" of <system>: \""
|
||||
<< qPrintable(operation) << "\"." << endl;
|
||||
// operation = _reader->attributes().value("operation").toString();
|
||||
// if ( operation.isEmpty() )
|
||||
// _environment.getLIBRARIES().reset();
|
||||
// else if ( operation != "append" )
|
||||
// cerr << "[ERROR] Invalid value for attribute \"operation\" of <system>: \""
|
||||
// << qPrintable(operation) << "\"." << endl;
|
||||
|
||||
parseTags ( TagsSystem );
|
||||
}
|
||||
|
@ -400,11 +400,23 @@ namespace {
|
|||
|
||||
void XmlEnvironmentParser::parseLibrary ()
|
||||
{
|
||||
unsigned int mode = Environment::Append;
|
||||
QString modeAttribute = _reader->attributes().value("mode").toString();
|
||||
|
||||
if ( not modeAttribute.isEmpty() ) {
|
||||
if ( modeAttribute == "append" ) mode = Environment::Append;
|
||||
else if ( modeAttribute == "prepend" ) mode = Environment::Prepend;
|
||||
else if ( modeAttribute == "replace" ) mode = Environment::Replace;
|
||||
else
|
||||
cerr << "[ERROR] Invalid value for attribute \"mode\" of <library>: \""
|
||||
<< qPrintable(modeAttribute) << "\"." << endl;
|
||||
}
|
||||
|
||||
string library = readTextAsString().toStdString();
|
||||
expandVariables ( library );
|
||||
switch ( _state ) {
|
||||
case WorkingLibrary: _environment.setWORKING_LIBRARY ( library.c_str() ); break;
|
||||
case SystemLibrary: _environment.addSYSTEM_LIBRARY ( library.c_str() ); break;
|
||||
case SystemLibrary: _environment.addSYSTEM_LIBRARY ( library.c_str(), mode ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,7 +559,7 @@ namespace CRL {
|
|||
{
|
||||
XmlEnvironmentParser::load ( *this, path, warnNotFound );
|
||||
|
||||
check ();
|
||||
_check ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -555,7 +567,7 @@ namespace CRL {
|
|||
{
|
||||
_CORIOLIS_TOP = getEnv ( "CORIOLIS_TOP", CORIOLIS_TOP );
|
||||
|
||||
check ();
|
||||
_check ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -586,28 +598,28 @@ namespace CRL {
|
|||
void Environment::setPOWER ( const char* value )
|
||||
{
|
||||
_POWER = value;
|
||||
setRegex ( &_PowerRegex , _POWER , "Power" );
|
||||
_setRegex ( &_PowerRegex , _POWER , "Power" );
|
||||
}
|
||||
|
||||
|
||||
void Environment::setGROUND ( const char* value )
|
||||
{
|
||||
_GROUND = value;
|
||||
setRegex ( &_GroundRegex , _GROUND , "Ground" );
|
||||
_setRegex ( &_GroundRegex , _GROUND , "Ground" );
|
||||
}
|
||||
|
||||
|
||||
void Environment::setCLOCK ( const char* value )
|
||||
{
|
||||
_CLOCK = value;
|
||||
setRegex ( &_ClockRegex , _CLOCK , "Clock" );
|
||||
_setRegex ( &_ClockRegex , _CLOCK , "Clock" );
|
||||
}
|
||||
|
||||
|
||||
void Environment::setOBSTACLE ( const char* value )
|
||||
{
|
||||
_OBSTACLE = value;
|
||||
setRegex ( &_ObstacleRegex , _OBSTACLE , "Obstacle" );
|
||||
_setRegex ( &_ObstacleRegex , _OBSTACLE , "Obstacle" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -657,7 +669,7 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void Environment::setRegex ( regex_t* regex, const string& pattern, const char* name )
|
||||
void Environment::_setRegex ( regex_t* regex, const string& pattern, const char* name )
|
||||
{
|
||||
char regexError[1024];
|
||||
int regexCode;
|
||||
|
@ -671,7 +683,7 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void Environment::check () const
|
||||
void Environment::_check () const
|
||||
{
|
||||
switch ( _SCALE_X ) {
|
||||
case 1: break;
|
||||
|
@ -713,4 +725,27 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
void Environment::addSYSTEM_LIBRARY ( const char* value, unsigned int mode )
|
||||
{
|
||||
if ( mode == Prepend ) { _LIBRARIES.prepend(value); return; }
|
||||
if ( mode == Append ) { _LIBRARIES.append (value); return; }
|
||||
|
||||
string newLibName = _getLibraryName ( value );
|
||||
for ( size_t i=0 ; i < _LIBRARIES.getSize() ; ++i ) {
|
||||
if ( newLibName == _getLibraryName(_LIBRARIES[i]) ) {
|
||||
_LIBRARIES.replace ( value, i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
_LIBRARIES.append (value);
|
||||
}
|
||||
|
||||
|
||||
string Environment::_getLibraryName ( const std::string& path )
|
||||
{
|
||||
size_t slash = path.rfind ( '/' );
|
||||
return path.substr ( (slash!=string::npos)?slash+1:0 );
|
||||
}
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./SearchPath.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# include "crlcore/SearchPath.h"
|
||||
|
@ -7,13 +28,14 @@
|
|||
|
||||
namespace CRL {
|
||||
|
||||
using namespace std;
|
||||
|
||||
const size_t SearchPath::npos = (size_t)-1;
|
||||
|
||||
|
||||
SearchPath::SearchPath ()
|
||||
: _paths()
|
||||
, _index(npos)
|
||||
: _paths ()
|
||||
, _index (npos)
|
||||
, _selected("")
|
||||
{
|
||||
}
|
||||
|
@ -44,11 +66,11 @@ namespace CRL {
|
|||
}
|
||||
|
||||
|
||||
bool SearchPath::hasPath ( const string& path ) const
|
||||
size_t SearchPath::hasPath ( const string& path ) const
|
||||
{
|
||||
for ( size_t i=0 ; i < _paths.size() ; i++ )
|
||||
if ( _paths[i] == path ) return true;
|
||||
return false;
|
||||
if ( _paths[i] == path ) return i;
|
||||
return npos;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,13 +89,13 @@ namespace CRL {
|
|||
AllianceLibrary ( const Name& path, Library* library=NULL );
|
||||
// Operators
|
||||
AllianceLibrary& operator= ( const AllianceLibrary& directory );
|
||||
AllianceLibrary& operator= ( const string& path );
|
||||
AllianceLibrary& operator= ( const std::string& path );
|
||||
// Accessors
|
||||
inline const Name& getPath () const;
|
||||
inline Library* getLibrary () const;
|
||||
// Hurricane management.
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
inline std::string _getTypeName () const;
|
||||
std::string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
|
||||
protected:
|
||||
|
@ -110,9 +110,9 @@ namespace CRL {
|
|||
|
||||
|
||||
// Inline Functions.
|
||||
inline const Name& AllianceLibrary::getPath () const { return _path; }
|
||||
inline Library* AllianceLibrary::getLibrary () const { return _library; }
|
||||
inline string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); }
|
||||
inline const Name& AllianceLibrary::getPath () const { return _path; }
|
||||
inline Library* AllianceLibrary::getLibrary () const { return _library; }
|
||||
inline std::string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); }
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./Environment.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#ifndef __CRL_ENVIRONMENT__
|
||||
|
@ -16,126 +37,128 @@ namespace CRL {
|
|||
|
||||
|
||||
class Environment {
|
||||
public:
|
||||
enum AddMode { Append=1, Prepend=2, Replace=3 };
|
||||
|
||||
public:
|
||||
// Internal: Static Methods.
|
||||
static const char* getEnv ( const char* variable, const char* defaultValue );
|
||||
static const char* getEnv ( const char* variable, const char* defaultValue );
|
||||
// Constructors & destructors.
|
||||
Environment ();
|
||||
~Environment ();
|
||||
Environment ();
|
||||
~Environment ();
|
||||
|
||||
// Accessors.
|
||||
inline const string& getCORIOLIS_TOP () const;
|
||||
inline const string& getDisplayStyle () const;
|
||||
inline long getSCALE_X () const;
|
||||
inline const string& getSYMBOLIC_TECHNOLOGY () const;
|
||||
inline const string& getREAL_TECHNOLOGY () const;
|
||||
inline const string& getLEF_TECHNOLOGY () const;
|
||||
inline const string& getDISPLAY () const;
|
||||
inline const string& getIN_LO () const;
|
||||
inline const string& getIN_PH () const;
|
||||
inline const string& getOUT_LO () const;
|
||||
inline const string& getOUT_PH () const;
|
||||
inline const string& getPOWER () const;
|
||||
inline const string& getGROUND () const;
|
||||
inline const string& getCLOCK () const;
|
||||
inline const string& getOBSTACLE () const;
|
||||
inline const string& getCATALOG () const;
|
||||
inline SearchPath& getLIBRARIES ();
|
||||
inline const std::string& getCORIOLIS_TOP () const;
|
||||
inline const std::string& getDisplayStyle () const;
|
||||
inline long getSCALE_X () const;
|
||||
inline const std::string& getSYMBOLIC_TECHNOLOGY () const;
|
||||
inline const std::string& getREAL_TECHNOLOGY () const;
|
||||
inline const std::string& getLEF_TECHNOLOGY () const;
|
||||
inline const std::string& getDISPLAY () const;
|
||||
inline const std::string& getIN_LO () const;
|
||||
inline const std::string& getIN_PH () const;
|
||||
inline const std::string& getOUT_LO () const;
|
||||
inline const std::string& getOUT_PH () const;
|
||||
inline const std::string& getPOWER () const;
|
||||
inline const std::string& getGROUND () const;
|
||||
inline const std::string& getCLOCK () const;
|
||||
inline const std::string& getOBSTACLE () const;
|
||||
inline const std::string& getCATALOG () const;
|
||||
inline SearchPath& getLIBRARIES ();
|
||||
|
||||
// Predicates.
|
||||
bool isPOWER ( const char* name ) const;
|
||||
bool isGROUND ( const char* name ) const;
|
||||
bool isCLOCK ( const char* name ) const;
|
||||
bool isOBSTACLE ( const char* name ) const;
|
||||
bool isPOWER ( const char* name ) const;
|
||||
bool isGROUND ( const char* name ) const;
|
||||
bool isCLOCK ( const char* name ) const;
|
||||
bool isOBSTACLE ( const char* name ) const;
|
||||
|
||||
// Modifiers.
|
||||
void loadFromXml ( const string& path="", bool warnNotFound=true );
|
||||
void loadFromShell ();
|
||||
inline void setDisplayStyle ( const char* );
|
||||
inline void setSCALE_X ( long value );
|
||||
inline void setSYMBOLIC_TECHNOLOGY ( const char* value );
|
||||
inline void setREAL_TECHNOLOGY ( const char* value );
|
||||
inline void setLEF_TECHNOLOGY ( const char* value );
|
||||
inline void setDISPLAY ( const char* value );
|
||||
inline void setIN_LO ( const char* value );
|
||||
inline void setIN_PH ( const char* value );
|
||||
inline void setOUT_LO ( const char* value );
|
||||
inline void setOUT_PH ( const char* value );
|
||||
void setPOWER ( const char* value );
|
||||
void setGROUND ( const char* value );
|
||||
void setCLOCK ( const char* value );
|
||||
void setOBSTACLE ( const char* value );
|
||||
inline void setCATALOG ( const char* value );
|
||||
inline void setWORKING_LIBRARY ( const char* value );
|
||||
inline void addSYSTEM_LIBRARY ( const char* value );
|
||||
void loadFromXml ( const std::string& path="", bool warnNotFound=true );
|
||||
void loadFromShell ();
|
||||
inline void setDisplayStyle ( const char* );
|
||||
inline void setSCALE_X ( long value );
|
||||
inline void setSYMBOLIC_TECHNOLOGY ( const char* value );
|
||||
inline void setREAL_TECHNOLOGY ( const char* value );
|
||||
inline void setLEF_TECHNOLOGY ( const char* value );
|
||||
inline void setDISPLAY ( const char* value );
|
||||
inline void setIN_LO ( const char* value );
|
||||
inline void setIN_PH ( const char* value );
|
||||
inline void setOUT_LO ( const char* value );
|
||||
inline void setOUT_PH ( const char* value );
|
||||
void setPOWER ( const char* value );
|
||||
void setGROUND ( const char* value );
|
||||
void setCLOCK ( const char* value );
|
||||
void setOBSTACLE ( const char* value );
|
||||
inline void setCATALOG ( const char* value );
|
||||
inline void setWORKING_LIBRARY ( const char* value );
|
||||
void addSYSTEM_LIBRARY ( const char* value, unsigned int mode=Append );
|
||||
|
||||
// Methods.
|
||||
string getPrint () const;
|
||||
std::string getPrint () const;
|
||||
|
||||
protected:
|
||||
// Internal: Attributes.
|
||||
string _CORIOLIS_TOP;
|
||||
string _displayStyle;
|
||||
long _SCALE_X;
|
||||
string _SYMBOLIC_TECHNOLOGY;
|
||||
string _LEF_TECHNOLOGY;
|
||||
string _REAL_TECHNOLOGY;
|
||||
string _DISPLAY;
|
||||
string _IN_LO;
|
||||
string _IN_PH;
|
||||
string _OUT_LO;
|
||||
string _OUT_PH;
|
||||
string _POWER;
|
||||
string _GROUND;
|
||||
string _CLOCK;
|
||||
string _OBSTACLE;
|
||||
string _CATALOG;
|
||||
SearchPath _LIBRARIES;
|
||||
regex_t _PowerRegex;
|
||||
regex_t _GroundRegex;
|
||||
regex_t _ClockRegex;
|
||||
regex_t _ObstacleRegex;
|
||||
bool _inConstructor;
|
||||
std::string _CORIOLIS_TOP;
|
||||
std::string _displayStyle;
|
||||
long _SCALE_X;
|
||||
std::string _SYMBOLIC_TECHNOLOGY;
|
||||
std::string _LEF_TECHNOLOGY;
|
||||
std::string _REAL_TECHNOLOGY;
|
||||
std::string _DISPLAY;
|
||||
std::string _IN_LO;
|
||||
std::string _IN_PH;
|
||||
std::string _OUT_LO;
|
||||
std::string _OUT_PH;
|
||||
std::string _POWER;
|
||||
std::string _GROUND;
|
||||
std::string _CLOCK;
|
||||
std::string _OBSTACLE;
|
||||
std::string _CATALOG;
|
||||
SearchPath _LIBRARIES;
|
||||
regex_t _PowerRegex;
|
||||
regex_t _GroundRegex;
|
||||
regex_t _ClockRegex;
|
||||
regex_t _ObstacleRegex;
|
||||
bool _inConstructor;
|
||||
|
||||
// Internal: Modifiers.
|
||||
void setRegex ( regex_t* regex, const string& pattern, const char* name );
|
||||
void check () const;
|
||||
private:
|
||||
void _setRegex ( regex_t* regex, const std::string& pattern, const char* name );
|
||||
void _check () const;
|
||||
static std::string _getLibraryName ( const std::string& path );
|
||||
};
|
||||
|
||||
|
||||
// Inline Member Functions.
|
||||
inline const string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; }
|
||||
inline const string& Environment::getDisplayStyle () const { return _displayStyle; }
|
||||
inline long Environment::getSCALE_X () const { return _SCALE_X; }
|
||||
inline const string& Environment::getSYMBOLIC_TECHNOLOGY () const { return _SYMBOLIC_TECHNOLOGY; }
|
||||
inline const string& Environment::getREAL_TECHNOLOGY () const { return _REAL_TECHNOLOGY; }
|
||||
inline const string& Environment::getLEF_TECHNOLOGY () const { return _LEF_TECHNOLOGY; }
|
||||
inline const string& Environment::getDISPLAY () const { return _DISPLAY; }
|
||||
inline const string& Environment::getIN_LO () const { return _IN_LO; }
|
||||
inline const string& Environment::getIN_PH () const { return _IN_PH; }
|
||||
inline const string& Environment::getOUT_LO () const { return _OUT_LO; }
|
||||
inline const string& Environment::getOUT_PH () const { return _OUT_PH; }
|
||||
inline const string& Environment::getPOWER () const { return _POWER; }
|
||||
inline const string& Environment::getGROUND () const { return _GROUND; }
|
||||
inline const string& Environment::getCLOCK () const { return _CLOCK; }
|
||||
inline const string& Environment::getOBSTACLE () const { return _OBSTACLE; }
|
||||
inline const string& Environment::getCATALOG () const { return _CATALOG; }
|
||||
inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; }
|
||||
|
||||
inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; }
|
||||
inline void Environment::setSCALE_X ( long value ) { _SCALE_X = value; }
|
||||
inline void Environment::setSYMBOLIC_TECHNOLOGY ( const char* value ) { _SYMBOLIC_TECHNOLOGY = value; }
|
||||
inline void Environment::setREAL_TECHNOLOGY ( const char* value ) { _REAL_TECHNOLOGY = value; }
|
||||
inline void Environment::setLEF_TECHNOLOGY ( const char* value ) { _LEF_TECHNOLOGY = value; }
|
||||
inline void Environment::setDISPLAY ( const char* value ) { _DISPLAY = value; }
|
||||
inline void Environment::setIN_LO ( const char* value ) { _IN_LO = value; }
|
||||
inline void Environment::setIN_PH ( const char* value ) { _IN_PH = value; }
|
||||
inline void Environment::setOUT_LO ( const char* value ) { _OUT_LO = value; }
|
||||
inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; }
|
||||
inline void Environment::setCATALOG ( const char* value ) { _CATALOG = value; }
|
||||
inline void Environment::setWORKING_LIBRARY ( const char* value ) { _LIBRARIES.replace(value,0); }
|
||||
inline void Environment::addSYSTEM_LIBRARY ( const char* value ) { _LIBRARIES.append(value); }
|
||||
inline const std::string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; }
|
||||
inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; }
|
||||
inline long Environment::getSCALE_X () const { return _SCALE_X; }
|
||||
inline const std::string& Environment::getSYMBOLIC_TECHNOLOGY () const { return _SYMBOLIC_TECHNOLOGY; }
|
||||
inline const std::string& Environment::getREAL_TECHNOLOGY () const { return _REAL_TECHNOLOGY; }
|
||||
inline const std::string& Environment::getLEF_TECHNOLOGY () const { return _LEF_TECHNOLOGY; }
|
||||
inline const std::string& Environment::getDISPLAY () const { return _DISPLAY; }
|
||||
inline const std::string& Environment::getIN_LO () const { return _IN_LO; }
|
||||
inline const std::string& Environment::getIN_PH () const { return _IN_PH; }
|
||||
inline const std::string& Environment::getOUT_LO () const { return _OUT_LO; }
|
||||
inline const std::string& Environment::getOUT_PH () const { return _OUT_PH; }
|
||||
inline const std::string& Environment::getPOWER () const { return _POWER; }
|
||||
inline const std::string& Environment::getGROUND () const { return _GROUND; }
|
||||
inline const std::string& Environment::getCLOCK () const { return _CLOCK; }
|
||||
inline const std::string& Environment::getOBSTACLE () const { return _OBSTACLE; }
|
||||
inline const std::string& Environment::getCATALOG () const { return _CATALOG; }
|
||||
inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; }
|
||||
|
||||
inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; }
|
||||
inline void Environment::setSCALE_X ( long value ) { _SCALE_X = value; }
|
||||
inline void Environment::setSYMBOLIC_TECHNOLOGY ( const char* value ) { _SYMBOLIC_TECHNOLOGY = value; }
|
||||
inline void Environment::setREAL_TECHNOLOGY ( const char* value ) { _REAL_TECHNOLOGY = value; }
|
||||
inline void Environment::setLEF_TECHNOLOGY ( const char* value ) { _LEF_TECHNOLOGY = value; }
|
||||
inline void Environment::setDISPLAY ( const char* value ) { _DISPLAY = value; }
|
||||
inline void Environment::setIN_LO ( const char* value ) { _IN_LO = value; }
|
||||
inline void Environment::setIN_PH ( const char* value ) { _IN_PH = value; }
|
||||
inline void Environment::setOUT_LO ( const char* value ) { _OUT_LO = value; }
|
||||
inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; }
|
||||
inline void Environment::setCATALOG ( const char* value ) { _CATALOG = value; }
|
||||
inline void Environment::setWORKING_LIBRARY ( const char* value ) { _LIBRARIES.replace(value,0); }
|
||||
|
||||
|
||||
} // End of CRL namespace.
|
||||
|
|
|
@ -52,23 +52,26 @@ namespace CRL {
|
|||
|
||||
class BaseMeasure {
|
||||
public:
|
||||
inline BaseMeasure ( const Name& );
|
||||
virtual ~BaseMeasure ();
|
||||
inline const Name& getName () const;
|
||||
virtual std::string toString () const = 0;
|
||||
inline BaseMeasure ( const Name&, unsigned int width );
|
||||
virtual ~BaseMeasure ();
|
||||
inline const Name& getName () const;
|
||||
inline unsigned int getFieldWidth () const;
|
||||
virtual std::string toString () const = 0;
|
||||
private:
|
||||
Name _name;
|
||||
unsigned int _fieldWidth;
|
||||
};
|
||||
|
||||
|
||||
inline BaseMeasure::BaseMeasure ( const Name& name ) : _name(name) {}
|
||||
inline const Name& BaseMeasure::getName () const { return _name; }
|
||||
inline BaseMeasure::BaseMeasure ( const Name& name, unsigned int width ) : _name(name), _fieldWidth(width) {}
|
||||
inline const Name& BaseMeasure::getName () const { return _name; }
|
||||
inline unsigned int BaseMeasure::getFieldWidth () const { return _fieldWidth; }
|
||||
|
||||
|
||||
template<typename Data>
|
||||
class Measure : public BaseMeasure {
|
||||
public:
|
||||
inline Measure ( const Name&, const Data& );
|
||||
inline Measure ( const Name&, const Data&, unsigned int width );
|
||||
inline const Data& getData () const;
|
||||
inline void setData ( const Data& );
|
||||
virtual std::string toString () const;
|
||||
|
@ -78,8 +81,8 @@ namespace CRL {
|
|||
|
||||
|
||||
template<typename Data>
|
||||
inline Measure<Data>::Measure ( const Name& name, const Data& data )
|
||||
: BaseMeasure(name), _data(data) { }
|
||||
inline Measure<Data>::Measure ( const Name& name, const Data& data, unsigned int width )
|
||||
: BaseMeasure(name,width), _data(data) { }
|
||||
|
||||
|
||||
template<typename Data>
|
||||
|
@ -121,24 +124,24 @@ namespace CRL {
|
|||
public:
|
||||
typedef StandardPrivateProperty<MeasuresDatas> Extension;
|
||||
public:
|
||||
template<typename Data> friend void addMeasure ( DBo*, const Name&, const Data& );
|
||||
template<typename Data> friend const Measure<Data>* getMeasure ( const DBo*, const Name& );
|
||||
static const MeasuresSet* get ( const DBo* );
|
||||
template<typename Data> friend inline void addMeasure ( DBo*, const Name&, const Data&, unsigned int width=8 );
|
||||
template<typename Data> friend inline const Measure<Data>* getMeasure ( DBo*, const Name& );
|
||||
static const MeasuresSet* get ( const DBo* );
|
||||
private:
|
||||
static Extension* _getOrCreate ( DBo* );
|
||||
static Extension* _getOrCreate ( DBo* );
|
||||
};
|
||||
|
||||
|
||||
template<typename Data>
|
||||
static void addMeasure ( DBo* object, const Name& name, const Data& data )
|
||||
inline void addMeasure ( DBo* object, const Name& name, const Data& data, unsigned int width )
|
||||
{
|
||||
Measures::Extension* extension = Measures::_getOrCreate ( object );
|
||||
extension->getValue()._measures.insert ( std::make_pair(name,new Measure<Data>(name,data)) );
|
||||
extension->getValue()._measures.insert ( std::make_pair(name,new Measure<Data>(name,data,width)) );
|
||||
}
|
||||
|
||||
|
||||
template<typename Data>
|
||||
static Measure<Data>* getMeasure ( DBo* object, const Name& name )
|
||||
inline const Measure<Data>* getMeasure ( DBo* object, const Name& name )
|
||||
{
|
||||
Measures::Extension* extension = Measures::_getOrCreate ( object );
|
||||
MeasuresSet::iterator imeasure = extension->getValue()._measures.find(name);
|
||||
|
|
|
@ -74,8 +74,8 @@ namespace CRL {
|
|||
};
|
||||
|
||||
|
||||
typedef list<ParserSlot> ParserSlots;
|
||||
typedef list<ParserSlot>::iterator ParserSlotIter;
|
||||
typedef std::list<ParserSlot> ParserSlots;
|
||||
typedef std::list<ParserSlot>::iterator ParserSlotIter;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -93,8 +93,8 @@ namespace CRL {
|
|||
inline LibraryParser_t* getParsLib ();
|
||||
inline CellParser_t* getParsCell ();
|
||||
// Modifiers.
|
||||
void registerCell ( const string& tag, CellParser_t* p, const string& ext );
|
||||
void registerLib ( const string& tag, LibraryParser_t* p, const string& ext );
|
||||
void registerCell ( const std::string& tag, CellParser_t* p, const std::string& ext );
|
||||
void registerLib ( const std::string& tag, LibraryParser_t* p, const std::string& ext );
|
||||
bool unRegisterCell ( const Name& ext );
|
||||
bool unRegisterLib ( const Name& ext );
|
||||
// Iterators handling.
|
||||
|
@ -133,10 +133,10 @@ namespace CRL {
|
|||
// Constructor.
|
||||
ParsersMap ();
|
||||
// Methods.
|
||||
ParserFormatSlot& getParserSlot ( const string& tag );
|
||||
ParserFormatSlot& getParserSlot ( const string& tag, unsigned int mode, const Environment& env );
|
||||
void registerSlot ( const string& tag, LibraryParser_t* p, const string& ext );
|
||||
void registerSlot ( const string& tag, CellParser_t* p, const string& ext );
|
||||
ParserFormatSlot& getParserSlot ( const std::string& tag );
|
||||
ParserFormatSlot& getParserSlot ( const std::string& tag, unsigned int mode, const Environment& env );
|
||||
void registerSlot ( const std::string& tag, LibraryParser_t* p, const std::string& ext );
|
||||
void registerSlot ( const std::string& tag, CellParser_t* p, const std::string& ext );
|
||||
void unRegisterSlot ( const Name& tag, const Name& ext, bool lib );
|
||||
};
|
||||
|
||||
|
@ -157,8 +157,8 @@ namespace CRL {
|
|||
inline CellDriver_t* getDrivCell ();
|
||||
|
||||
// Modifiers.
|
||||
inline void setExtLib ( const string &ext );
|
||||
inline void setExtCell ( const string &ext );
|
||||
inline void setExtLib ( const std::string &ext );
|
||||
inline void setExtCell ( const std::string &ext );
|
||||
inline void setDrivLib ( LibraryDriver_t *driv );
|
||||
inline void setDrivCell ( CellDriver_t *driv );
|
||||
|
||||
|
@ -184,8 +184,8 @@ namespace CRL {
|
|||
inline const Name& DriverSlot::getExtCell () { return ( _extCell ); }
|
||||
inline LibraryDriver_t* DriverSlot::getDrivLib () { return ( _drivLib ); }
|
||||
inline CellDriver_t* DriverSlot::getDrivCell () { return ( _drivCell ); }
|
||||
inline void DriverSlot::setExtLib ( const string& ext ) { _extLib = ext; }
|
||||
inline void DriverSlot::setExtCell ( const string& ext ) { _extCell = ext; }
|
||||
inline void DriverSlot::setExtLib ( const std::string& ext ) { _extLib = ext; }
|
||||
inline void DriverSlot::setExtCell ( const std::string& ext ) { _extCell = ext; }
|
||||
inline void DriverSlot::setDrivLib ( LibraryDriver_t* driv ) { _drivLib = driv; }
|
||||
inline void DriverSlot::setDrivCell ( CellDriver_t* driv ) { _drivCell = driv; }
|
||||
|
||||
|
@ -201,10 +201,10 @@ namespace CRL {
|
|||
// Constructor.
|
||||
DriversMap ();
|
||||
// Methods.
|
||||
DriverSlot& getDriverSlot ( const string& tag );
|
||||
DriverSlot& getDriverSlot ( const string& tag, unsigned int mode, const Environment& env );
|
||||
void registerSlot ( const string& tag, CellDriver_t *d, const string& ext );
|
||||
void registerSlot ( const string& tag, LibraryDriver_t *d, const string& ext );
|
||||
DriverSlot& getDriverSlot ( const std::string& tag );
|
||||
DriverSlot& getDriverSlot ( const std::string& tag, unsigned int mode, const Environment& env );
|
||||
void registerSlot ( const std::string& tag, CellDriver_t *d, const std::string& ext );
|
||||
void registerSlot ( const std::string& tag, LibraryDriver_t *d, const std::string& ext );
|
||||
void unRegisterSlot ( const Name& tag );
|
||||
};
|
||||
|
||||
|
|
|
@ -1,77 +1,87 @@
|
|||
|
||||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// x-----------------------------------------------------------------x
|
||||
// | |
|
||||
// | C O R I O L I S |
|
||||
// | Alliance / Hurricane Interface |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./SearchPath.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
# ifndef __CRL_SEARCH_PATH__
|
||||
# define __CRL_SEARCH_PATH__
|
||||
#ifndef __CRL_SEARCH_PATH__
|
||||
# define __CRL_SEARCH_PATH__
|
||||
|
||||
|
||||
# include <string>
|
||||
# include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
# include "hurricane/Commons.h"
|
||||
# include "hurricane/Slot.h"
|
||||
#include "hurricane/Commons.h"
|
||||
#include "hurricane/Slot.h"
|
||||
|
||||
|
||||
namespace CRL {
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Hurricane::Record;
|
||||
using Hurricane::_TName;
|
||||
|
||||
|
||||
class SearchPath {
|
||||
|
||||
public:
|
||||
// Constants.
|
||||
static const size_t npos;
|
||||
|
||||
// Constructors.
|
||||
SearchPath ();
|
||||
|
||||
// Methods.
|
||||
inline void reset ();
|
||||
inline void append ( const string& path );
|
||||
void replace ( const string& path, size_t index );
|
||||
size_t locate ( const string& file
|
||||
, ios::openmode mode =ios::in
|
||||
, int first=0
|
||||
, int last =64 );
|
||||
inline size_t getSize () const;
|
||||
inline const string& getSelected () const;
|
||||
inline size_t getIndex () const;
|
||||
bool hasSelected () const;
|
||||
bool hasPath ( const string& path ) const;
|
||||
const string& operator[] ( size_t index ) const;
|
||||
|
||||
// Internal - Attributes.
|
||||
private:
|
||||
vector<string> _paths;
|
||||
size_t _index;
|
||||
string _selected;
|
||||
|
||||
// Internal - Constructors.
|
||||
private:
|
||||
SearchPath ( const SearchPath& );
|
||||
|
||||
// Hurricane management.
|
||||
static const size_t npos;
|
||||
SearchPath ();
|
||||
public:
|
||||
inline string _getTypeName () const;
|
||||
string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
inline void reset ();
|
||||
inline void append ( const std::string& path );
|
||||
inline void prepend ( const std::string& path );
|
||||
void replace ( const std::string& path, size_t index );
|
||||
size_t locate ( const std::string& file
|
||||
, std::ios::openmode mode =std::ios::in
|
||||
, int first=0
|
||||
, int last =64 );
|
||||
inline size_t getSize () const;
|
||||
inline const std::string& getSelected () const;
|
||||
inline size_t getIndex () const;
|
||||
bool hasSelected () const;
|
||||
size_t hasPath ( const std::string& path ) const;
|
||||
const std::string& operator[] ( size_t index ) const;
|
||||
private:
|
||||
std::vector<std::string> _paths;
|
||||
size_t _index;
|
||||
std::string _selected;
|
||||
private:
|
||||
SearchPath ( const SearchPath& );
|
||||
public:
|
||||
inline std::string _getTypeName () const;
|
||||
std::string _getString () const;
|
||||
Record* _getRecord () const;
|
||||
};
|
||||
|
||||
|
||||
// Inline Functions.
|
||||
inline void SearchPath::reset () { _paths.resize(1); }
|
||||
inline void SearchPath::append ( const string& path ) { _paths.push_back(path); }
|
||||
inline size_t SearchPath::getSize () const { return _paths.size(); }
|
||||
inline const string& SearchPath::getSelected () const { return _selected; }
|
||||
inline size_t SearchPath::getIndex () const { return _index; }
|
||||
inline bool SearchPath::hasSelected () const { return _index != npos; }
|
||||
inline string SearchPath::_getTypeName () const { return _TName("SearchPath"); }
|
||||
inline void SearchPath::reset () { _paths.resize(1); }
|
||||
inline void SearchPath::prepend ( const std::string& path ) { _paths.insert ( _paths.begin(), path ); }
|
||||
inline void SearchPath::append ( const std::string& path ) { _paths.push_back(path); }
|
||||
inline size_t SearchPath::getSize () const { return _paths.size(); }
|
||||
inline const std::string& SearchPath::getSelected () const { return _selected; }
|
||||
inline size_t SearchPath::getIndex () const { return _index; }
|
||||
inline bool SearchPath::hasSelected () const { return _index != npos; }
|
||||
inline std::string SearchPath::_getTypeName () const { return _TName("SearchPath"); }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::DbU;
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using namespace std;
|
||||
|
||||
using Hurricane::Warning;
|
||||
using Hurricane::Error;
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace CRL {
|
|||
if ( imeasure == end() ) continue;
|
||||
|
||||
const BaseMeasure* measure = (*imeasure).second;
|
||||
out << setw(8) << right << measure->getName();
|
||||
out << setw(measure->getFieldWidth()) << right << measure->getName();
|
||||
}
|
||||
|
||||
return out.str();
|
||||
|
@ -96,7 +96,7 @@ namespace CRL {
|
|||
if ( imeasure == end() ) continue;
|
||||
|
||||
const BaseMeasure* measure = (*imeasure).second;
|
||||
out << setw(8) << right << measure->toString();
|
||||
out << setw(measure->getFieldWidth()) << right << measure->toString();
|
||||
}
|
||||
|
||||
return out.str();
|
||||
|
|
|
@ -180,11 +180,15 @@ int main ( int argc, char *argv[] )
|
|||
|
||||
if ( arguments.count("cell") ) {
|
||||
cell = af->getCell (arguments["cell"].as<string>().c_str(), Catalog::State::Views );
|
||||
if (!cell) {
|
||||
if ( cell == NULL ) {
|
||||
cerr << af->getPrint() << endl;
|
||||
cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>().c_str() << endl;
|
||||
exit ( -45 );
|
||||
}
|
||||
|
||||
// Slot* slot = getSlot ( "_netMap", &(cell->_getNetMap()) );
|
||||
// Record* record = slot->getDataRecord();
|
||||
// cerr << "_netMap(0): " << record->getSlot(0)->getDataString() << endl;
|
||||
}
|
||||
|
||||
if ( not textMode ) {
|
||||
|
|
Loading…
Reference in New Issue