* ./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:
Jean-Paul Chaput 2010-05-13 09:45:20 +00:00
parent 57f3e4e107
commit cd7a294ca9
12 changed files with 315 additions and 216 deletions

View File

@ -20,7 +20,7 @@
<working> <working>
<library>.</library> <library>.</library>
</working> </working>
<system operation="append"> <system>
<library>${CELL_TOP}/cells/sxlib</library> <library>${CELL_TOP}/cells/sxlib</library>
<library>${CELL_TOP}/cells/dp_sxlib</library> <library>${CELL_TOP}/cells/dp_sxlib</library>
<library>${CELL_TOP}/cells/ramlib</library> <library>${CELL_TOP}/cells/ramlib</library>

View File

@ -2,7 +2,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // 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 | // | Author : Jean-Paul CHAPUT |
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
// | =============================================================== | // | =============================================================== |
// | C++ Module : "./Environnment.h" | // | C++ Module : "./Environnment.cpp" |
// | *************************************************************** | // | *************************************************************** |
// | U p d a t e s | // | U p d a t e s |
// | | // | |
@ -387,12 +387,12 @@ namespace {
QString operation; QString operation;
operation = _reader->attributes().value("operation").toString(); // operation = _reader->attributes().value("operation").toString();
if ( operation.isEmpty() ) // if ( operation.isEmpty() )
_environment.getLIBRARIES().reset(); // _environment.getLIBRARIES().reset();
else if ( operation != "append" ) // else if ( operation != "append" )
cerr << "[ERROR] Invalid value for attribute \"operation\" of <system>: \"" // cerr << "[ERROR] Invalid value for attribute \"operation\" of <system>: \""
<< qPrintable(operation) << "\"." << endl; // << qPrintable(operation) << "\"." << endl;
parseTags ( TagsSystem ); parseTags ( TagsSystem );
} }
@ -400,11 +400,23 @@ namespace {
void XmlEnvironmentParser::parseLibrary () 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(); string library = readTextAsString().toStdString();
expandVariables ( library ); expandVariables ( library );
switch ( _state ) { switch ( _state ) {
case WorkingLibrary: _environment.setWORKING_LIBRARY ( library.c_str() ); break; 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 ); XmlEnvironmentParser::load ( *this, path, warnNotFound );
check (); _check ();
} }
@ -555,7 +567,7 @@ namespace CRL {
{ {
_CORIOLIS_TOP = getEnv ( "CORIOLIS_TOP", CORIOLIS_TOP ); _CORIOLIS_TOP = getEnv ( "CORIOLIS_TOP", CORIOLIS_TOP );
check (); _check ();
} }
@ -586,28 +598,28 @@ namespace CRL {
void Environment::setPOWER ( const char* value ) void Environment::setPOWER ( const char* value )
{ {
_POWER = value; _POWER = value;
setRegex ( &_PowerRegex , _POWER , "Power" ); _setRegex ( &_PowerRegex , _POWER , "Power" );
} }
void Environment::setGROUND ( const char* value ) void Environment::setGROUND ( const char* value )
{ {
_GROUND = value; _GROUND = value;
setRegex ( &_GroundRegex , _GROUND , "Ground" ); _setRegex ( &_GroundRegex , _GROUND , "Ground" );
} }
void Environment::setCLOCK ( const char* value ) void Environment::setCLOCK ( const char* value )
{ {
_CLOCK = value; _CLOCK = value;
setRegex ( &_ClockRegex , _CLOCK , "Clock" ); _setRegex ( &_ClockRegex , _CLOCK , "Clock" );
} }
void Environment::setOBSTACLE ( const char* value ) void Environment::setOBSTACLE ( const char* value )
{ {
_OBSTACLE = 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]; char regexError[1024];
int regexCode; int regexCode;
@ -671,7 +683,7 @@ namespace CRL {
} }
void Environment::check () const void Environment::_check () const
{ {
switch ( _SCALE_X ) { switch ( _SCALE_X ) {
case 1: break; 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. } // End of CRL namespace.

View File

@ -1,5 +1,26 @@
// -*- C++ -*- // -*- 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" # include "crlcore/SearchPath.h"
@ -7,6 +28,7 @@
namespace CRL { namespace CRL {
using namespace std;
const size_t SearchPath::npos = (size_t)-1; const size_t SearchPath::npos = (size_t)-1;
@ -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++ ) for ( size_t i=0 ; i < _paths.size() ; i++ )
if ( _paths[i] == path ) return true; if ( _paths[i] == path ) return i;
return false; return npos;
} }

View File

@ -89,13 +89,13 @@ namespace CRL {
AllianceLibrary ( const Name& path, Library* library=NULL ); AllianceLibrary ( const Name& path, Library* library=NULL );
// Operators // Operators
AllianceLibrary& operator= ( const AllianceLibrary& directory ); AllianceLibrary& operator= ( const AllianceLibrary& directory );
AllianceLibrary& operator= ( const string& path ); AllianceLibrary& operator= ( const std::string& path );
// Accessors // Accessors
inline const Name& getPath () const; inline const Name& getPath () const;
inline Library* getLibrary () const; inline Library* getLibrary () const;
// Hurricane management. // Hurricane management.
inline string _getTypeName () const; inline std::string _getTypeName () const;
string _getString () const; std::string _getString () const;
Record* _getRecord () const; Record* _getRecord () const;
protected: protected:
@ -112,7 +112,7 @@ namespace CRL {
// Inline Functions. // Inline Functions.
inline const Name& AllianceLibrary::getPath () const { return _path; } inline const Name& AllianceLibrary::getPath () const { return _path; }
inline Library* AllianceLibrary::getLibrary () const { return _library; } inline Library* AllianceLibrary::getLibrary () const { return _library; }
inline string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); } inline std::string AllianceLibrary::_getTypeName () const { return _TName("AllianceLibrary"); }
} // End of CRL namespace. } // End of CRL namespace.

View File

@ -1,5 +1,26 @@
// -*- C++ -*- // -*- 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__ #ifndef __CRL_ENVIRONMENT__
@ -16,6 +37,8 @@ namespace CRL {
class Environment { class Environment {
public:
enum AddMode { Append=1, Prepend=2, Replace=3 };
public: public:
// Internal: Static Methods. // Internal: Static Methods.
@ -25,22 +48,22 @@ namespace CRL {
~Environment (); ~Environment ();
// Accessors. // Accessors.
inline const string& getCORIOLIS_TOP () const; inline const std::string& getCORIOLIS_TOP () const;
inline const string& getDisplayStyle () const; inline const std::string& getDisplayStyle () const;
inline long getSCALE_X () const; inline long getSCALE_X () const;
inline const string& getSYMBOLIC_TECHNOLOGY () const; inline const std::string& getSYMBOLIC_TECHNOLOGY () const;
inline const string& getREAL_TECHNOLOGY () const; inline const std::string& getREAL_TECHNOLOGY () const;
inline const string& getLEF_TECHNOLOGY () const; inline const std::string& getLEF_TECHNOLOGY () const;
inline const string& getDISPLAY () const; inline const std::string& getDISPLAY () const;
inline const string& getIN_LO () const; inline const std::string& getIN_LO () const;
inline const string& getIN_PH () const; inline const std::string& getIN_PH () const;
inline const string& getOUT_LO () const; inline const std::string& getOUT_LO () const;
inline const string& getOUT_PH () const; inline const std::string& getOUT_PH () const;
inline const string& getPOWER () const; inline const std::string& getPOWER () const;
inline const string& getGROUND () const; inline const std::string& getGROUND () const;
inline const string& getCLOCK () const; inline const std::string& getCLOCK () const;
inline const string& getOBSTACLE () const; inline const std::string& getOBSTACLE () const;
inline const string& getCATALOG () const; inline const std::string& getCATALOG () const;
inline SearchPath& getLIBRARIES (); inline SearchPath& getLIBRARIES ();
// Predicates. // Predicates.
@ -50,7 +73,7 @@ namespace CRL {
bool isOBSTACLE ( const char* name ) const; bool isOBSTACLE ( const char* name ) const;
// Modifiers. // Modifiers.
void loadFromXml ( const string& path="", bool warnNotFound=true ); void loadFromXml ( const std::string& path="", bool warnNotFound=true );
void loadFromShell (); void loadFromShell ();
inline void setDisplayStyle ( const char* ); inline void setDisplayStyle ( const char* );
inline void setSCALE_X ( long value ); inline void setSCALE_X ( long value );
@ -68,29 +91,29 @@ namespace CRL {
void setOBSTACLE ( const char* value ); void setOBSTACLE ( const char* value );
inline void setCATALOG ( const char* value ); inline void setCATALOG ( const char* value );
inline void setWORKING_LIBRARY ( const char* value ); inline void setWORKING_LIBRARY ( const char* value );
inline void addSYSTEM_LIBRARY ( const char* value ); void addSYSTEM_LIBRARY ( const char* value, unsigned int mode=Append );
// Methods. // Methods.
string getPrint () const; std::string getPrint () const;
protected: protected:
// Internal: Attributes. // Internal: Attributes.
string _CORIOLIS_TOP; std::string _CORIOLIS_TOP;
string _displayStyle; std::string _displayStyle;
long _SCALE_X; long _SCALE_X;
string _SYMBOLIC_TECHNOLOGY; std::string _SYMBOLIC_TECHNOLOGY;
string _LEF_TECHNOLOGY; std::string _LEF_TECHNOLOGY;
string _REAL_TECHNOLOGY; std::string _REAL_TECHNOLOGY;
string _DISPLAY; std::string _DISPLAY;
string _IN_LO; std::string _IN_LO;
string _IN_PH; std::string _IN_PH;
string _OUT_LO; std::string _OUT_LO;
string _OUT_PH; std::string _OUT_PH;
string _POWER; std::string _POWER;
string _GROUND; std::string _GROUND;
string _CLOCK; std::string _CLOCK;
string _OBSTACLE; std::string _OBSTACLE;
string _CATALOG; std::string _CATALOG;
SearchPath _LIBRARIES; SearchPath _LIBRARIES;
regex_t _PowerRegex; regex_t _PowerRegex;
regex_t _GroundRegex; regex_t _GroundRegex;
@ -98,29 +121,30 @@ namespace CRL {
regex_t _ObstacleRegex; regex_t _ObstacleRegex;
bool _inConstructor; bool _inConstructor;
// Internal: Modifiers. private:
void setRegex ( regex_t* regex, const string& pattern, const char* name ); void _setRegex ( regex_t* regex, const std::string& pattern, const char* name );
void check () const; void _check () const;
static std::string _getLibraryName ( const std::string& path );
}; };
// Inline Member Functions. // Inline Member Functions.
inline const string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; } inline const std::string& Environment::getCORIOLIS_TOP () const { return _CORIOLIS_TOP; }
inline const string& Environment::getDisplayStyle () const { return _displayStyle; } inline const std::string& Environment::getDisplayStyle () const { return _displayStyle; }
inline long Environment::getSCALE_X () const { return _SCALE_X; } inline long Environment::getSCALE_X () const { return _SCALE_X; }
inline const string& Environment::getSYMBOLIC_TECHNOLOGY () const { return _SYMBOLIC_TECHNOLOGY; } inline const std::string& Environment::getSYMBOLIC_TECHNOLOGY () const { return _SYMBOLIC_TECHNOLOGY; }
inline const string& Environment::getREAL_TECHNOLOGY () const { return _REAL_TECHNOLOGY; } inline const std::string& Environment::getREAL_TECHNOLOGY () const { return _REAL_TECHNOLOGY; }
inline const string& Environment::getLEF_TECHNOLOGY () const { return _LEF_TECHNOLOGY; } inline const std::string& Environment::getLEF_TECHNOLOGY () const { return _LEF_TECHNOLOGY; }
inline const string& Environment::getDISPLAY () const { return _DISPLAY; } inline const std::string& Environment::getDISPLAY () const { return _DISPLAY; }
inline const string& Environment::getIN_LO () const { return _IN_LO; } inline const std::string& Environment::getIN_LO () const { return _IN_LO; }
inline const string& Environment::getIN_PH () const { return _IN_PH; } inline const std::string& Environment::getIN_PH () const { return _IN_PH; }
inline const string& Environment::getOUT_LO () const { return _OUT_LO; } inline const std::string& Environment::getOUT_LO () const { return _OUT_LO; }
inline const string& Environment::getOUT_PH () const { return _OUT_PH; } inline const std::string& Environment::getOUT_PH () const { return _OUT_PH; }
inline const string& Environment::getPOWER () const { return _POWER; } inline const std::string& Environment::getPOWER () const { return _POWER; }
inline const string& Environment::getGROUND () const { return _GROUND; } inline const std::string& Environment::getGROUND () const { return _GROUND; }
inline const string& Environment::getCLOCK () const { return _CLOCK; } inline const std::string& Environment::getCLOCK () const { return _CLOCK; }
inline const string& Environment::getOBSTACLE () const { return _OBSTACLE; } inline const std::string& Environment::getOBSTACLE () const { return _OBSTACLE; }
inline const string& Environment::getCATALOG () const { return _CATALOG; } inline const std::string& Environment::getCATALOG () const { return _CATALOG; }
inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; } inline SearchPath& Environment::getLIBRARIES () { return _LIBRARIES; }
inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; } inline void Environment::setDisplayStyle ( const char* value ) { _displayStyle = value; }
@ -135,7 +159,6 @@ namespace CRL {
inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; } inline void Environment::setOUT_PH ( const char* value ) { _OUT_PH = value; }
inline void Environment::setCATALOG ( const char* value ) { _CATALOG = 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::setWORKING_LIBRARY ( const char* value ) { _LIBRARIES.replace(value,0); }
inline void Environment::addSYSTEM_LIBRARY ( const char* value ) { _LIBRARIES.append(value); }
} // End of CRL namespace. } // End of CRL namespace.

View File

@ -52,23 +52,26 @@ namespace CRL {
class BaseMeasure { class BaseMeasure {
public: public:
inline BaseMeasure ( const Name& ); inline BaseMeasure ( const Name&, unsigned int width );
virtual ~BaseMeasure (); virtual ~BaseMeasure ();
inline const Name& getName () const; inline const Name& getName () const;
inline unsigned int getFieldWidth () const;
virtual std::string toString () const = 0; virtual std::string toString () const = 0;
private: private:
Name _name; Name _name;
unsigned int _fieldWidth;
}; };
inline BaseMeasure::BaseMeasure ( const Name& name ) : _name(name) {} inline BaseMeasure::BaseMeasure ( const Name& name, unsigned int width ) : _name(name), _fieldWidth(width) {}
inline const Name& BaseMeasure::getName () const { return _name; } inline const Name& BaseMeasure::getName () const { return _name; }
inline unsigned int BaseMeasure::getFieldWidth () const { return _fieldWidth; }
template<typename Data> template<typename Data>
class Measure : public BaseMeasure { class Measure : public BaseMeasure {
public: public:
inline Measure ( const Name&, const Data& ); inline Measure ( const Name&, const Data&, unsigned int width );
inline const Data& getData () const; inline const Data& getData () const;
inline void setData ( const Data& ); inline void setData ( const Data& );
virtual std::string toString () const; virtual std::string toString () const;
@ -78,8 +81,8 @@ namespace CRL {
template<typename Data> template<typename Data>
inline Measure<Data>::Measure ( const Name& name, const Data& data ) inline Measure<Data>::Measure ( const Name& name, const Data& data, unsigned int width )
: BaseMeasure(name), _data(data) { } : BaseMeasure(name,width), _data(data) { }
template<typename Data> template<typename Data>
@ -121,8 +124,8 @@ namespace CRL {
public: public:
typedef StandardPrivateProperty<MeasuresDatas> Extension; typedef StandardPrivateProperty<MeasuresDatas> Extension;
public: public:
template<typename Data> friend void addMeasure ( DBo*, const Name&, const Data& ); template<typename Data> friend inline void addMeasure ( DBo*, const Name&, const Data&, unsigned int width=8 );
template<typename Data> friend const Measure<Data>* getMeasure ( const DBo*, const Name& ); template<typename Data> friend inline const Measure<Data>* getMeasure ( DBo*, const Name& );
static const MeasuresSet* get ( const DBo* ); static const MeasuresSet* get ( const DBo* );
private: private:
static Extension* _getOrCreate ( DBo* ); static Extension* _getOrCreate ( DBo* );
@ -130,15 +133,15 @@ namespace CRL {
template<typename Data> 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 ); 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> 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 ); Measures::Extension* extension = Measures::_getOrCreate ( object );
MeasuresSet::iterator imeasure = extension->getValue()._measures.find(name); MeasuresSet::iterator imeasure = extension->getValue()._measures.find(name);

View File

@ -74,8 +74,8 @@ namespace CRL {
}; };
typedef list<ParserSlot> ParserSlots; typedef std::list<ParserSlot> ParserSlots;
typedef list<ParserSlot>::iterator ParserSlotIter; typedef std::list<ParserSlot>::iterator ParserSlotIter;
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -93,8 +93,8 @@ namespace CRL {
inline LibraryParser_t* getParsLib (); inline LibraryParser_t* getParsLib ();
inline CellParser_t* getParsCell (); inline CellParser_t* getParsCell ();
// Modifiers. // Modifiers.
void registerCell ( const string& tag, CellParser_t* p, const string& ext ); void registerCell ( const std::string& tag, CellParser_t* p, const std::string& ext );
void registerLib ( const string& tag, LibraryParser_t* p, const string& ext ); void registerLib ( const std::string& tag, LibraryParser_t* p, const std::string& ext );
bool unRegisterCell ( const Name& ext ); bool unRegisterCell ( const Name& ext );
bool unRegisterLib ( const Name& ext ); bool unRegisterLib ( const Name& ext );
// Iterators handling. // Iterators handling.
@ -133,10 +133,10 @@ namespace CRL {
// Constructor. // Constructor.
ParsersMap (); ParsersMap ();
// Methods. // Methods.
ParserFormatSlot& getParserSlot ( const string& tag ); ParserFormatSlot& getParserSlot ( const std::string& tag );
ParserFormatSlot& getParserSlot ( const string& tag, unsigned int mode, const Environment& env ); ParserFormatSlot& getParserSlot ( const std::string& tag, unsigned int mode, const Environment& env );
void registerSlot ( const string& tag, LibraryParser_t* p, const string& ext ); void registerSlot ( const std::string& tag, LibraryParser_t* p, const std::string& ext );
void registerSlot ( const string& tag, CellParser_t* p, const 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 ); void unRegisterSlot ( const Name& tag, const Name& ext, bool lib );
}; };
@ -157,8 +157,8 @@ namespace CRL {
inline CellDriver_t* getDrivCell (); inline CellDriver_t* getDrivCell ();
// Modifiers. // Modifiers.
inline void setExtLib ( const string &ext ); inline void setExtLib ( const std::string &ext );
inline void setExtCell ( const string &ext ); inline void setExtCell ( const std::string &ext );
inline void setDrivLib ( LibraryDriver_t *driv ); inline void setDrivLib ( LibraryDriver_t *driv );
inline void setDrivCell ( CellDriver_t *driv ); inline void setDrivCell ( CellDriver_t *driv );
@ -184,8 +184,8 @@ namespace CRL {
inline const Name& DriverSlot::getExtCell () { return ( _extCell ); } inline const Name& DriverSlot::getExtCell () { return ( _extCell ); }
inline LibraryDriver_t* DriverSlot::getDrivLib () { return ( _drivLib ); } inline LibraryDriver_t* DriverSlot::getDrivLib () { return ( _drivLib ); }
inline CellDriver_t* DriverSlot::getDrivCell () { return ( _drivCell ); } inline CellDriver_t* DriverSlot::getDrivCell () { return ( _drivCell ); }
inline void DriverSlot::setExtLib ( const string& ext ) { _extLib = ext; } inline void DriverSlot::setExtLib ( const std::string& ext ) { _extLib = ext; }
inline void DriverSlot::setExtCell ( const string& ext ) { _extCell = ext; } inline void DriverSlot::setExtCell ( const std::string& ext ) { _extCell = ext; }
inline void DriverSlot::setDrivLib ( LibraryDriver_t* driv ) { _drivLib = driv; } inline void DriverSlot::setDrivLib ( LibraryDriver_t* driv ) { _drivLib = driv; }
inline void DriverSlot::setDrivCell ( CellDriver_t* driv ) { _drivCell = driv; } inline void DriverSlot::setDrivCell ( CellDriver_t* driv ) { _drivCell = driv; }
@ -201,10 +201,10 @@ namespace CRL {
// Constructor. // Constructor.
DriversMap (); DriversMap ();
// Methods. // Methods.
DriverSlot& getDriverSlot ( const string& tag ); DriverSlot& getDriverSlot ( const std::string& tag );
DriverSlot& getDriverSlot ( const string& tag, unsigned int mode, const Environment& env ); DriverSlot& getDriverSlot ( const std::string& tag, unsigned int mode, const Environment& env );
void registerSlot ( const string& tag, CellDriver_t *d, const string& ext ); void registerSlot ( const std::string& tag, CellDriver_t *d, const std::string& ext );
void registerSlot ( const string& tag, LibraryDriver_t *d, const string& ext ); void registerSlot ( const std::string& tag, LibraryDriver_t *d, const std::string& ext );
void unRegisterSlot ( const Name& tag ); void unRegisterSlot ( const Name& tag );
}; };

View File

@ -1,5 +1,26 @@
// -*- C++ -*- // -*- 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__ #ifndef __CRL_SEARCH_PATH__
@ -16,62 +37,51 @@
namespace CRL { namespace CRL {
using namespace std;
using Hurricane::Record; using Hurricane::Record;
using Hurricane::_TName; using Hurricane::_TName;
class SearchPath { class SearchPath {
public: public:
// Constants.
static const size_t npos; static const size_t npos;
// Constructors.
SearchPath (); SearchPath ();
public:
// Methods.
inline void reset (); inline void reset ();
inline void append ( const string& path ); inline void append ( const std::string& path );
void replace ( const string& path, size_t index ); inline void prepend ( const std::string& path );
size_t locate ( const string& file void replace ( const std::string& path, size_t index );
, ios::openmode mode =ios::in size_t locate ( const std::string& file
, std::ios::openmode mode =std::ios::in
, int first=0 , int first=0
, int last =64 ); , int last =64 );
inline size_t getSize () const; inline size_t getSize () const;
inline const string& getSelected () const; inline const std::string& getSelected () const;
inline size_t getIndex () const; inline size_t getIndex () const;
bool hasSelected () const; bool hasSelected () const;
bool hasPath ( const string& path ) const; size_t hasPath ( const std::string& path ) const;
const string& operator[] ( size_t index ) const; const std::string& operator[] ( size_t index ) const;
// Internal - Attributes.
private: private:
vector<string> _paths; std::vector<std::string> _paths;
size_t _index; size_t _index;
string _selected; std::string _selected;
// Internal - Constructors.
private: private:
SearchPath ( const SearchPath& ); SearchPath ( const SearchPath& );
// Hurricane management.
public: public:
inline string _getTypeName () const; inline std::string _getTypeName () const;
string _getString () const; std::string _getString () const;
Record* _getRecord () const; Record* _getRecord () const;
}; };
// Inline Functions. // Inline Functions.
inline void SearchPath::reset () { _paths.resize(1); } inline void SearchPath::reset () { _paths.resize(1); }
inline void SearchPath::append ( const string& path ) { _paths.push_back(path); } 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 size_t SearchPath::getSize () const { return _paths.size(); }
inline const string& SearchPath::getSelected () const { return _selected; } inline const std::string& SearchPath::getSelected () const { return _selected; }
inline size_t SearchPath::getIndex () const { return _index; } inline size_t SearchPath::getIndex () const { return _index; }
inline bool SearchPath::hasSelected () const { return _index != npos; } inline bool SearchPath::hasSelected () const { return _index != npos; }
inline string SearchPath::_getTypeName () const { return _TName("SearchPath"); } inline std::string SearchPath::_getTypeName () const { return _TName("SearchPath"); }

View File

@ -56,6 +56,7 @@
namespace { namespace {
using namespace std;
using Hurricane::Warning; using Hurricane::Warning;
using Hurricane::DbU; using Hurricane::DbU;

View File

@ -75,6 +75,7 @@
namespace { namespace {
using namespace std;
using Hurricane::Warning; using Hurricane::Warning;
using Hurricane::Error; using Hurricane::Error;

View File

@ -79,7 +79,7 @@ namespace CRL {
if ( imeasure == end() ) continue; if ( imeasure == end() ) continue;
const BaseMeasure* measure = (*imeasure).second; const BaseMeasure* measure = (*imeasure).second;
out << setw(8) << right << measure->getName(); out << setw(measure->getFieldWidth()) << right << measure->getName();
} }
return out.str(); return out.str();
@ -96,7 +96,7 @@ namespace CRL {
if ( imeasure == end() ) continue; if ( imeasure == end() ) continue;
const BaseMeasure* measure = (*imeasure).second; const BaseMeasure* measure = (*imeasure).second;
out << setw(8) << right << measure->toString(); out << setw(measure->getFieldWidth()) << right << measure->toString();
} }
return out.str(); return out.str();

View File

@ -180,11 +180,15 @@ int main ( int argc, char *argv[] )
if ( arguments.count("cell") ) { if ( arguments.count("cell") ) {
cell = af->getCell (arguments["cell"].as<string>().c_str(), Catalog::State::Views ); cell = af->getCell (arguments["cell"].as<string>().c_str(), Catalog::State::Views );
if (!cell) { if ( cell == NULL ) {
cerr << af->getPrint() << endl; cerr << af->getPrint() << endl;
cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>().c_str() << endl; cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>().c_str() << endl;
exit ( -45 ); exit ( -45 );
} }
// Slot* slot = getSlot ( "_netMap", &(cell->_getNetMap()) );
// Record* record = slot->getDataRecord();
// cerr << "_netMap(0): " << record->getSlot(0)->getDataString() << endl;
} }
if ( not textMode ) { if ( not textMode ) {