using the new Inspector Framework
This commit is contained in:
parent
cec61f96cb
commit
14090f45ab
|
@ -5,6 +5,7 @@ using namespace Hurricane;
|
||||||
|
|
||||||
#include "crlcore/GraphicsParser.h"
|
#include "crlcore/GraphicsParser.h"
|
||||||
#include "crlcore/SymbolicTechnologyParser.h"
|
#include "crlcore/SymbolicTechnologyParser.h"
|
||||||
|
#include "crlcore/RealTechnologyParser.h"
|
||||||
using namespace CRL;
|
using namespace CRL;
|
||||||
|
|
||||||
#include "ATechnology.h"
|
#include "ATechnology.h"
|
||||||
|
@ -12,13 +13,17 @@ using namespace CRL;
|
||||||
|
|
||||||
#include "AEnv.h"
|
#include "AEnv.h"
|
||||||
|
|
||||||
void AEnv::create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath) {
|
void AEnv::create(const char* symbTechnoFilePath,
|
||||||
|
const char* realTechnoFilePath,
|
||||||
|
const char* graphicFilePath,
|
||||||
|
const char* analogTechnoFilePath) {
|
||||||
DataBase* db = DataBase::getDB();
|
DataBase* db = DataBase::getDB();
|
||||||
if (db) {
|
if (db) {
|
||||||
throw Error("");
|
throw Error("");
|
||||||
}
|
}
|
||||||
db = DataBase::create();
|
db = DataBase::create();
|
||||||
SymbolicTechnologyParser::load(db, technoFilePath);
|
SymbolicTechnologyParser::load(db, symbTechnoFilePath);
|
||||||
|
RealTechnologyParser::load(db, realTechnoFilePath);
|
||||||
GraphicsParser::load(graphicFilePath);
|
GraphicsParser::load(graphicFilePath);
|
||||||
|
|
||||||
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
|
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
|
||||||
|
|
|
@ -5,7 +5,10 @@ class ATechnology;
|
||||||
|
|
||||||
class AEnv {
|
class AEnv {
|
||||||
public:
|
public:
|
||||||
static void create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath);
|
static void create(const char* symbTechnoFilePath,
|
||||||
|
const char* realTechnoFilePath,
|
||||||
|
const char* graphicFilePath,
|
||||||
|
const char* analogTechnoFilePath);
|
||||||
static ATechnology* getATechnology();
|
static ATechnology* getATechnology();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,38 @@ void printPhysicalRules(const ATechnology::TwoLayersPhysicalRulesSet& physicalRu
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string ATechnology::PhysicalRule::_getTypeName() const {
|
||||||
|
return "PhysicalRule";
|
||||||
|
}
|
||||||
|
|
||||||
|
string ATechnology::PhysicalRule::_getString() const {
|
||||||
|
return "<" + _getTypeName() + " " + getString(_name) + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
Record* ATechnology::PhysicalRule::_getRecord() const {
|
||||||
|
Record* record = new Record(getString(this));
|
||||||
|
record->add(getSlot("Name", &_name));
|
||||||
|
record->add(getSlot("Value", &_value));
|
||||||
|
record->add(getSlot("Reference", &_reference));
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
|
string ATechnology::TwoLayersPhysicalRule::_getTypeName() const {
|
||||||
|
return "TwoLayersPhysicalRule";
|
||||||
|
}
|
||||||
|
|
||||||
|
string ATechnology::TwoLayersPhysicalRule::_getString() const {
|
||||||
|
return "<" + _getTypeName() + " " + getString(_name) + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
Record* ATechnology::TwoLayersPhysicalRule::_getRecord() const {
|
||||||
|
Record* record = Inherit::_getRecord();
|
||||||
|
if (record) {
|
||||||
|
record->add(getSlot("Symetric", _symetric));
|
||||||
|
}
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
Name ATechnology::getName() const {
|
Name ATechnology::getName() const {
|
||||||
return ATechnologyPropertyName;
|
return ATechnologyPropertyName;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +72,16 @@ string ATechnology::_getTypeName() const {
|
||||||
return _TName("ATechnologyProperty");
|
return _TName("ATechnologyProperty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Record* ATechnology::_getRecord() const {
|
||||||
|
Record* record = Inherit::_getRecord();
|
||||||
|
if (record) {
|
||||||
|
record->add(getSlot("NoLayerPhysicalRules", &_noLayerPhysicalRules));
|
||||||
|
record->add(getSlot("OneLayerPhysicalRules", &_oneLayerPhysicalRules));
|
||||||
|
record->add(getSlot("TwoLayersPhysicalRules", &_twoLayersPhysicalRules));
|
||||||
|
}
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
void ATechnology::addPhysicalRule(const Name& name, DbU::Unit value, const string& reference) {
|
void ATechnology::addPhysicalRule(const Name& name, DbU::Unit value, const string& reference) {
|
||||||
PhysicalRule searchPR(name, 0, "");
|
PhysicalRule searchPR(name, 0, "");
|
||||||
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR);
|
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR);
|
||||||
|
|
|
@ -29,10 +29,16 @@ class ATechnology : public PrivateProperty {
|
||||||
const DbU::Unit _value;
|
const DbU::Unit _value;
|
||||||
const string _reference;
|
const string _reference;
|
||||||
double getValue() const { return _value; }
|
double getValue() const { return _value; }
|
||||||
|
|
||||||
|
string _getTypeName() const;
|
||||||
|
string _getString() const;
|
||||||
|
Record* _getRecord() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TwoLayersPhysicalRule : public PhysicalRule {
|
class TwoLayersPhysicalRule : public PhysicalRule {
|
||||||
public:
|
public:
|
||||||
|
typedef PhysicalRule Inherit;
|
||||||
|
|
||||||
TwoLayersPhysicalRule(const Name& name,
|
TwoLayersPhysicalRule(const Name& name,
|
||||||
DbU::Unit value,
|
DbU::Unit value,
|
||||||
const string& reference,
|
const string& reference,
|
||||||
|
@ -42,6 +48,10 @@ class ATechnology : public PrivateProperty {
|
||||||
|
|
||||||
bool isSymetric() const { return _symetric; }
|
bool isSymetric() const { return _symetric; }
|
||||||
const bool _symetric;
|
const bool _symetric;
|
||||||
|
|
||||||
|
string _getTypeName() const;
|
||||||
|
string _getString() const;
|
||||||
|
Record* _getRecord() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PhysicalRuleNameCompare:
|
struct PhysicalRuleNameCompare:
|
||||||
|
@ -73,6 +83,7 @@ class ATechnology : public PrivateProperty {
|
||||||
virtual Name getName() const;
|
virtual Name getName() const;
|
||||||
|
|
||||||
virtual string _getTypeName() const;
|
virtual string _getTypeName() const;
|
||||||
|
virtual Record* _getRecord() const;
|
||||||
|
|
||||||
ATechnology():
|
ATechnology():
|
||||||
Inherit(),
|
Inherit(),
|
||||||
|
@ -86,4 +97,25 @@ class ATechnology : public PrivateProperty {
|
||||||
TwoLayersPhysicalRules _twoLayersPhysicalRules;
|
TwoLayersPhysicalRules _twoLayersPhysicalRules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// Inspector Support for : "ATechnology::LayerPair&".
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline std::string getString<ATechnology::LayerPair&> (ATechnology::LayerPair& lp) {
|
||||||
|
return "<LayerPair layer1=" + getString(lp.first) + ", layer2=" + getString(lp.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline Hurricane::Record* getRecord<ATechnology::LayerPair&> (ATechnology::LayerPair& lp) {
|
||||||
|
Hurricane::Record* record = new Hurricane::Record(getString(&lp));
|
||||||
|
record->add(getSlot("Layer1", lp.first));
|
||||||
|
record->add(getSlot("Layer2", lp.second));
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
|
INSPECTOR_P_SUPPORT(ATechnology);
|
||||||
|
INSPECTOR_P_SUPPORT(ATechnology::PhysicalRule);
|
||||||
|
INSPECTOR_P_SUPPORT(ATechnology::TwoLayersPhysicalRule);
|
||||||
|
|
||||||
#endif /* ATECHNOLOGY_H_*/
|
#endif /* ATECHNOLOGY_H_*/
|
||||||
|
|
|
@ -17,6 +17,11 @@ void syntaxError(const string& reason) {
|
||||||
throw Error(reason);
|
throw Error(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbU::Unit getUnitValue(double physicalValue) {
|
||||||
|
cerr << "akecoucou : " << DbU::getPhysicalsPerGrid() << endl;
|
||||||
|
return DbU::grid(DbU::physicalToGrid(physicalValue, DbU::Micro));
|
||||||
|
}
|
||||||
|
|
||||||
void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
|
void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
|
||||||
if (node->type == XML_ELEMENT_NODE && node->children) {
|
if (node->type == XML_ELEMENT_NODE && node->children) {
|
||||||
for (xmlNode* ruleNode = node->children;
|
for (xmlNode* ruleNode = node->children;
|
||||||
|
@ -32,7 +37,8 @@ void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
|
||||||
if (ruleNameC && valueC && refC && layer1C && layer2C) {
|
if (ruleNameC && valueC && refC && layer1C && layer2C) {
|
||||||
string ruleName((const char*)ruleNameC);
|
string ruleName((const char*)ruleNameC);
|
||||||
double value = atof((const char*)valueC);
|
double value = atof((const char*)valueC);
|
||||||
DbU::Unit unitValue= DbU::grid(value);
|
DbU::Unit unitValue = getUnitValue(value);
|
||||||
|
cerr << value << ", " << unitValue << endl;
|
||||||
string reference((const char*)refC);
|
string reference((const char*)refC);
|
||||||
Name layer1Name((const char*)layer1C);
|
Name layer1Name((const char*)layer1C);
|
||||||
Name layer2Name((const char*)layer2C);
|
Name layer2Name((const char*)layer2C);
|
||||||
|
@ -48,7 +54,7 @@ void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
|
||||||
if (ruleNameC && valueC && refC) {
|
if (ruleNameC && valueC && refC) {
|
||||||
string ruleName((const char*)ruleNameC);
|
string ruleName((const char*)ruleNameC);
|
||||||
double value = atof((const char*)valueC);
|
double value = atof((const char*)valueC);
|
||||||
DbU::Unit unitValue= DbU::grid(value);
|
DbU::Unit unitValue = getUnitValue(value);
|
||||||
string reference((const char*)refC);
|
string reference((const char*)refC);
|
||||||
if (layerC) {
|
if (layerC) {
|
||||||
Name layerName((const char*)layerC);
|
Name layerName((const char*)layerC);
|
||||||
|
|
|
@ -22,11 +22,11 @@ int main(int argc, char* argv[]) {
|
||||||
QApplication* qa = new QApplication(argc, argv);
|
QApplication* qa = new QApplication(argc, argv);
|
||||||
|
|
||||||
cout << "simple analogic test" << endl;
|
cout << "simple analogic test" << endl;
|
||||||
if (argc != 4) {
|
if (argc != 5) {
|
||||||
cerr << "atest techno.xml graphic.xml anatechno.xml";
|
cerr << "atest symbtechno.xml s2rtechno.xml graphic.xml anatechno.xml";
|
||||||
exit(56);
|
exit(56);
|
||||||
}
|
}
|
||||||
AEnv::create(argv[1], argv[2], argv[3]);
|
AEnv::create(argv[1], argv[2], argv[3], argv[4]);
|
||||||
DataBase* db = DataBase::getDB();
|
DataBase* db = DataBase::getDB();
|
||||||
Library* rootLibrary = db->getRootLibrary();
|
Library* rootLibrary = db->getRootLibrary();
|
||||||
Library* userLibrary = Library::create(rootLibrary, Name("USER"));
|
Library* userLibrary = Library::create(rootLibrary, Name("USER"));
|
||||||
|
|
Loading…
Reference in New Issue